From bcad3d84939c0cf49419ab940442dfda4b3b7bd9 Mon Sep 17 00:00:00 2001 From: dece Date: Sat, 13 May 2023 02:09:06 +0200 Subject: [PATCH] Show a logo for podcasts --- src/Entity/Podcast.php | 9 +++++++++ src/Service/FeedService.php | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/Entity/Podcast.php b/src/Entity/Podcast.php index c8e8c87..d64a96e 100644 --- a/src/Entity/Podcast.php +++ b/src/Entity/Podcast.php @@ -176,4 +176,13 @@ class Podcast return $this; } + + public function getLogoUrl(): ?string + { + if ($this->logoFilename === null) { + return null; + } + + return Constants::IMAGES_BASE_PATH . $this->logoFilename; + } } diff --git a/src/Service/FeedService.php b/src/Service/FeedService.php index 66fa1ea..6cabb3c 100644 --- a/src/Service/FeedService.php +++ b/src/Service/FeedService.php @@ -43,6 +43,11 @@ class FeedService $titleElement->appendChild(new DOMText($podcast->getName())); $channelElement->appendChild(new DOMElement('description', $podcast->getDescription())); $channelElement->appendChild(new DOMElement('link', $podcast->getWebsite())); + $imageElement = new DOMElement('image'); + $imageElement->appendChild(new DOMElement('url', $podcast->getLogoUrl())); + $imageElement->appendChild(new DOMElement('title', 'logo')); + $imageElement->appendChild(new DOMElement('link', $podcast->getWebsite())); + $channelElement->appendChild($imageElement); $episodes = $this->entityManager->createQuery( 'SELECT e FROM App\Entity\Episode e'