tools/import_article: add align=center to images

This commit is contained in:
E. S. 2025-02-09 04:29:04 +03:00
parent 863da9ba08
commit 50d299e38b
2 changed files with 5 additions and 5 deletions

View File

@ -218,13 +218,13 @@ class Upload extends model {
return sizeString($this->size); return sizeString($this->size);
} }
function getMarkdown(): string { function getMarkdown(?string $options = null): string {
if ($this->isImage()) { if ($this->isImage()) {
$md = '{image:'.$this->randomId.',w='.$this->imageW.',h='.$this->imageH.'}{/image}'; $md = '{image:'.$this->randomId.',w='.$this->imageW.',h='.$this->imageH.($options ? ','.$options : '').'}{/image}';
} else if ($this->isVideo()) { } else if ($this->isVideo()) {
$md = '{video:'.$this->randomId.'}{/video}'; $md = '{video:'.$this->randomId.($options ? ','.$options : '').'}{/video}';
} else { } else {
$md = '{fileAttach:'.$this->randomId.'}{/fileAttach}'; $md = '{fileAttach:'.$this->randomId.($options ? ','.$options : '').'}{/fileAttach}';
} }
$md .= ' <!-- '.$this->name.' -->'; $md .= ' <!-- '.$this->name.' -->';
return $md; return $md;

View File

@ -86,7 +86,7 @@ function processImages($md) {
logDebug('found existing upload with source_url='.$clean_url); logDebug('found existing upload with source_url='.$clean_url);
} }
return $upload->getMarkdown(); return $upload->getMarkdown('align=center');
}, },
$md $md
); );