From: Kevin Decherf Date: Sat, 16 Feb 2019 19:37:20 +0000 (+0100) Subject: epub export: fix missing cover image, only for exports of one article X-Git-Tag: 2.3.7~5^2 X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=9a7a0e1e6b7ac8aeb110346e8ada841060496a1a epub export: fix missing cover image, only for exports of one article Fixes #3602 Signed-off-by: Kevin Decherf --- diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 64591687..a2aa4d13 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -165,13 +165,6 @@ class EntriesExport $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'PHP'); $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'wallabag'); - /* - * Front page - */ - if (file_exists($this->logoPath)) { - $book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png'); - } - $entryIds = []; $entryCount = \count($this->entries); $i = 0; @@ -183,6 +176,15 @@ class EntriesExport // set tags as subjects foreach ($this->entries as $entry) { ++$i; + + /* + * Front page + * Set if there's only one entry in the given set + */ + if (1 === $entryCount && null !== $entry->getPreviewPicture()) { + $book->setCoverImage($entry->getPreviewPicture()); + } + foreach ($entry->getTags() as $tag) { $book->setSubject($tag->getLabel()); }