🐛 rss: Improve image handling

Taken from https://github.com/bludit/bludit/pull/1559
This commit is contained in:
Kazhnuz 2025-07-03 21:27:20 +02:00
parent 89caf537b9
commit da20d6a67d

View file

@ -44,11 +44,14 @@ class pluginRSS extends Plugin
try {
// Create the page object from the page key
$page = new Page($pageKey);
$imagepath = parse_url($page->coverImage(true), PHP_URL_PATH);
$imagepath = $_SERVER['DOCUMENT_ROOT'] . $imagepath;
$xml .= '<item>';
$xml .= '<title>' . $page->title() . '</title>';
$xml .= '<link>' . $this->encodeURL($page->permalink()) . '</link>';
$xml .= '<image>' . $page->coverImage(true) . '</image>';
$xml .= '<description>' . Sanitize::html($page->contentBreak()) . '</description>';
$xml .= '<enclosure url="'.$page->coverImage(true).'" length="'.filesize($imagepath).'" type="'.mime_content_type($imagepath).'" />';
$xml .= '<description>'.strip_tags( $page->contentBreak() ).'</description>';
$xml .= '<pubDate>' . date(DATE_RSS, strtotime($page->getValue('dateRaw'))) . '</pubDate>';
$xml .= '<guid isPermaLink="false">' . $page->uuid() . '</guid>';
$xml .= '</item>';