aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-02-25 14:03:41 +0100
committerGitHub <noreply@github.com>2019-02-25 14:03:41 +0100
commitd5154ee2ae4f5cdf0a2ee8ea02bd696a6a95171d (patch)
tree285a0855d7efa42dc5ab238740224c38ad4441bd
parent4de99d1ab161fc378e0f7cc121c60396f86bc577 (diff)
parent9a7a0e1e6b7ac8aeb110346e8ada841060496a1a (diff)
downloadwallabag-d5154ee2ae4f5cdf0a2ee8ea02bd696a6a95171d.tar.gz
wallabag-d5154ee2ae4f5cdf0a2ee8ea02bd696a6a95171d.tar.zst
wallabag-d5154ee2ae4f5cdf0a2ee8ea02bd696a6a95171d.zip
Merge pull request #3886 from wallabag/issue-3602
epub export: fix missing cover image, only for exports of one article
-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 }