]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/EntriesExport.php
Merge remote-tracking branch 'origin/master' into 2.4
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / EntriesExport.php
index 1a611199412f5bd259c54fcc140feb08c0cf54f5..f981ee50e61b8a323ae091f97f1139b82896de17 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,16 +176,24 @@ 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());
             }
-            $filename = sha1($entry->getTitle());
+            $filename = sha1(sprintf('%s:%s', $entry->getUrl(), $entry->getTitle()));
 
             $publishedBy = $entry->getPublishedBy();
+            $authors = $this->translator->trans('export.unknown');
             if (!empty($publishedBy)) {
                 $authors = implode(',', $publishedBy);
-            } else {
-                $authors = $this->translator->trans('export.unknown');
             }
 
             $titlepage = $content_start .
@@ -305,10 +306,9 @@ class EntriesExport
             }
 
             $publishedBy = $entry->getPublishedBy();
+            $authors = $this->translator->trans('export.unknown');
             if (!empty($publishedBy)) {
                 $authors = implode(',', $publishedBy);
-            } else {
-                $authors = $this->translator->trans('export.unknown');
             }
 
             $pdf->addPage();