]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3886 from wallabag/issue-3602
authorJérémy Benoist <j0k3r@users.noreply.github.com>
Mon, 25 Feb 2019 13:03:41 +0000 (14:03 +0100)
committerGitHub <noreply@github.com>
Mon, 25 Feb 2019 13:03:41 +0000 (14:03 +0100)
epub export: fix missing cover image, only for exports of one article

src/Wallabag/CoreBundle/Helper/EntriesExport.php

index 64591687d58e66a42eb129bb021f5fcfe5dbed79..a2aa4d134e4aebe60abcbfce631d1cadc40c18cf 100644 (file)
@@ -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());
             }