aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2019-02-16 20:37:20 +0100
committerKevin Decherf <kevin@kdecherf.com>2019-02-18 00:16:05 +0100
commit9a7a0e1e6b7ac8aeb110346e8ada841060496a1a (patch)
tree919163870d216aee7e07177c5c431b340551d2e0 /src
parentb1992b340e21b6846a1ec2ae6ddd7217f3b24fb5 (diff)
downloadwallabag-9a7a0e1e6b7ac8aeb110346e8ada841060496a1a.tar.gz
wallabag-9a7a0e1e6b7ac8aeb110346e8ada841060496a1a.tar.zst
wallabag-9a7a0e1e6b7ac8aeb110346e8ada841060496a1a.zip
epub export: fix missing cover image, only for exports of one article
Fixes #3602 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php16
1 files changed, 9 insertions, 7 deletions
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
165 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'PHP'); 165 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'PHP');
166 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'wallabag'); 166 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'wallabag');
167 167
168 /*
169 * Front page
170 */
171 if (file_exists($this->logoPath)) {
172 $book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png');
173 }
174
175 $entryIds = []; 168 $entryIds = [];
176 $entryCount = \count($this->entries); 169 $entryCount = \count($this->entries);
177 $i = 0; 170 $i = 0;
@@ -183,6 +176,15 @@ class EntriesExport
183 // set tags as subjects 176 // set tags as subjects
184 foreach ($this->entries as $entry) { 177 foreach ($this->entries as $entry) {
185 ++$i; 178 ++$i;
179
180 /*
181 * Front page
182 * Set if there's only one entry in the given set
183 */
184 if (1 === $entryCount && null !== $entry->getPreviewPicture()) {
185 $book->setCoverImage($entry->getPreviewPicture());
186 }
187
186 foreach ($entry->getTags() as $tag) { 188 foreach ($entry->getTags() as $tag) {
187 $book->setSubject($tag->getLabel()); 189 $book->setSubject($tag->getLabel());
188 } 190 }