if ($image === '') {
$image = 'articles/' . $file;
}
- $this->vdir->copy($this->wdir . '/articles/' . $file, 'data/articles/' . $file);
+ $filepath = $this->wdir . '/articles/' . $file;
+ $this->vdir->copy($filepath, 'data/articles/' . $file);
$legend = (string)$child;
$caption = $legend ? '<figcaption>' . $legend . '</figcaption>' : '';
- $inner .= '<figure><img src="data/articles/' . $file . '" alt="' . $legend . '">' . $caption . '</figure>';
+ if (file_exists($filepath)) {
+ $dim = getimagesize($filepath);
+ } else {
+ $dim = [0 => 1024, 1 => 10];
+ }
+ $inner .= '<figure><img src="data/articles/' . $file . '" alt="' . $legend . '" width="' . $dim[0] . '" height="' . $dim[1] . '">' . $caption . '</figure>';
} else {
$c = trim($this->SimpleXMLElement_innerXML($child));
if (!$c) {
public function init()
{
parent::init();
- $this->compiler->config->articlesList[$this->to]['page'] = $this->page;
$this->article = $this->compiler->config->articlesList[$this->to];
+ if (!isset($this->compiler->config->articlesList[$this->to]['page'])) {
+ $this->compiler->config->articlesList[$this->to]['page'] = $this->page;
+ }
}
public function getURL()