Fix image in RSS

This commit is contained in:
Laurent Destailleur
2024-09-30 16:09:19 +02:00
parent 4b9ce8a9bc
commit 5886355a87

View File

@@ -397,6 +397,18 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
$tmpevent['desc'] = $event->description;
if (!empty($event->image)) {
$tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$event->image;
} else {
include_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
$tmpimage = getImageFromHtmlContent($event->content);
if ($tmpimage) {
if (strpos($tmpimage, '/') === 0) { // If $tmpimage is an absolute path
$tmpevent['image'] = $GLOBALS['website']->virtualhost.$tmpimage;
} elseif (stripos($tmpimage, 'http:') === 0) { // If $tmpimage is a full URI
$tmpevent['image'] = $tmpimage;
} else {
$tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$tmpimage;
} // TODO If $tmpimage is "data:..."
}
}
$tmpevent['content'] = $event->content;