diff options
-rw-r--r-- | inc/3rdparty/libraries/PHPePub/EPub.php | 12 | ||||
-rwxr-xr-x | inc/poche/Poche.class.php | 23 |
2 files changed, 22 insertions, 13 deletions
diff --git a/inc/3rdparty/libraries/PHPePub/EPub.php b/inc/3rdparty/libraries/PHPePub/EPub.php index 0260ce4f..e120b341 100644 --- a/inc/3rdparty/libraries/PHPePub/EPub.php +++ b/inc/3rdparty/libraries/PHPePub/EPub.php | |||
@@ -574,7 +574,7 @@ class EPub { | |||
574 | * @param string $mimetype Image mimetype, such as "image/jpeg" or "image/png". | 574 | * @param string $mimetype Image mimetype, such as "image/jpeg" or "image/png". |
575 | * @return bool $success | 575 | * @return bool $success |
576 | */ | 576 | */ |
577 | function setCoverImage($fileName, $imageData = NULL, $mimetype = NULL) { | 577 | function setCover($fileName, $imageData = NULL, $mimetype = NULL, $coverText=NULL) { |
578 | if ($this->isFinalized || $this->isCoverImageSet || array_key_exists("CoverPage.html", $this->fileList)) { | 578 | if ($this->isFinalized || $this->isCoverImageSet || array_key_exists("CoverPage.html", $this->fileList)) { |
579 | return FALSE; | 579 | return FALSE; |
580 | } | 580 | } |
@@ -621,12 +621,13 @@ class EPub { | |||
621 | . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\" xml:lang=\"en\">\n" | 621 | . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\" xml:lang=\"en\">\n" |
622 | . "\t<head>\n" | 622 | . "\t<head>\n" |
623 | . "\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n" | 623 | . "\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n" |
624 | . "\t\t<title>Cover Image</title>\n" | 624 | . "\t\t<title>Cover</title>\n" |
625 | . "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"Styles/CoverPage.css\" />\n" | 625 | . "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"Styles/CoverPage.css\" />\n" |
626 | . "\t</head>\n" | 626 | . "\t</head>\n" |
627 | . "\t<body>\n" | 627 | . "\t<body>\n" |
628 | . "\t\t" . $coverText . "\n" | ||
628 | . "\t\t<div>\n" | 629 | . "\t\t<div>\n" |
629 | . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 100%\"/>\n" | 630 | . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 40%\"/>\n" |
630 | . "\t\t</div>\n" | 631 | . "\t\t</div>\n" |
631 | . "\t</body>\n" | 632 | . "\t</body>\n" |
632 | . "</html>\n"; | 633 | . "</html>\n"; |
@@ -635,12 +636,13 @@ class EPub { | |||
635 | . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" | 636 | . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" |
636 | . "<head>" | 637 | . "<head>" |
637 | . "\t<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" | 638 | . "\t<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" |
638 | . "\t\t<title>Cover Image</title>\n" | 639 | . "\t\t<title>Cover</title>\n" |
639 | . "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"Styles/CoverPage.css\" />\n" | 640 | . "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"Styles/CoverPage.css\" />\n" |
640 | . "\t</head>\n" | 641 | . "\t</head>\n" |
641 | . "\t<body>\n" | 642 | . "\t<body>\n" |
642 | . "\t\t<section epub:type=\"cover\">\n" | 643 | . "\t\t<section epub:type=\"cover\">\n" |
643 | . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 100%\"/>\n" | 644 | . "\t\t" . $coverText . "\n" |
645 | . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 40%\"/>\n" | ||
644 | . "\t\t</section>\n" | 646 | . "\t\t</section>\n" |
645 | . "\t</body>\n" | 647 | . "\t</body>\n" |
646 | . "</html>\n"; | 648 | . "</html>\n"; |
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index c476df3e..c99bfcba 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -1200,30 +1200,37 @@ class Poche | |||
1200 | $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); | 1200 | $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); |
1201 | 1201 | ||
1202 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); | 1202 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); |
1203 | $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag"); | ||
1203 | 1204 | ||
1204 | $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; | 1205 | $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; |
1205 | 1206 | ||
1206 | $log->logLine("Add Cover Image"); | 1207 | $log->logLine("Add Cover"); |
1207 | $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png"); | 1208 | if (count($entries)>1){ |
1209 | $cover = "<h1>" . $entries[0]['title'] . " and " . count($entries) . " other articles</h1>"; | ||
1210 | } else { | ||
1211 | $cover = "<h1>" . $entries[0]['title'] . "</h1>"; | ||
1212 | } | ||
1213 | $book->setCover("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $cover); | ||
1214 | |||
1208 | 1215 | ||
1209 | $cover = $content_start . "<h1>My articles on wallabag</h1>\n<h2>As seen on : http://$_SERVER[HTTP_HOST]</h2>\n" . $bookEnd; | 1216 | $book->setCover($cover); |
1210 | $book->addChapter("Notices", "Cover.html", $cover); | 1217 | //$book->addChapter("Notices", "Cover.html", $cover); |
1211 | $book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE); | 1218 | $book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE); |
1219 | $subject = ""; | ||
1212 | 1220 | ||
1213 | foreach ($entries as $entry) { | 1221 | foreach ($entries as $entry) { |
1214 | $tags = $this->store->retrieveTagsByEntry($entry['id']); | 1222 | $tags = $this->store->retrieveTagsByEntry($entry['id']); |
1215 | foreach ($tags as $tag) { | 1223 | foreach ($tags as $tag) { |
1216 | $book->setSubject($tag['value']); | 1224 | $subject =. $tag['value'] . ','; |
1217 | } | 1225 | } |
1218 | 1226 | ||
1219 | $log->logLine("Set up parameters"); | 1227 | $log->logLine("Set up parameters"); |
1220 | 1228 | ||
1221 | |||
1222 | |||
1223 | $chapter = $content_start . $entry['content'] . $bookEnd; | 1229 | $chapter = $content_start . $entry['content'] . $bookEnd; |
1224 | $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); | 1230 | $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); |
1231 | $log->logLine("Added chapter " . $entry['title']); | ||
1225 | } | 1232 | } |
1226 | 1233 | $book->setSubject($subject); | |
1227 | 1234 | ||
1228 | if (DEBUG_POCHE) { | 1235 | if (DEBUG_POCHE) { |
1229 | $epuplog = $book->getLog(); | 1236 | $epuplog = $book->getLog(); |