* @param string $mimetype Image mimetype, such as "image/jpeg" or "image/png".
* @return bool $success
*/
- function setCoverImage($fileName, $imageData = NULL, $mimetype = NULL) {
+ function setCover($fileName, $imageData = NULL, $mimetype = NULL, $coverText=NULL) {
if ($this->isFinalized || $this->isCoverImageSet || array_key_exists("CoverPage.html", $this->fileList)) {
return FALSE;
}
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\" xml:lang=\"en\">\n"
. "\t<head>\n"
. "\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n"
- . "\t\t<title>Cover Image</title>\n"
+ . "\t\t<title>Cover</title>\n"
. "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"Styles/CoverPage.css\" />\n"
. "\t</head>\n"
. "\t<body>\n"
+ . "\t\t" . $coverText . "\n"
. "\t\t<div>\n"
- . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 100%\"/>\n"
+ . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 40%\"/>\n"
. "\t\t</div>\n"
. "\t</body>\n"
. "</html>\n";
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n"
. "<head>"
. "\t<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n"
- . "\t\t<title>Cover Image</title>\n"
+ . "\t\t<title>Cover</title>\n"
. "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"Styles/CoverPage.css\" />\n"
. "\t</head>\n"
. "\t<body>\n"
. "\t\t<section epub:type=\"cover\">\n"
- . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 100%\"/>\n"
+ . "\t\t" . $coverText . "\n"
+ . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 40%\"/>\n"
. "\t\t</section>\n"
. "\t</body>\n"
. "</html>\n";
$book->setSourceURL("http://$_SERVER[HTTP_HOST]");
$book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP");
+ $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag");
$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";
- $log->logLine("Add Cover Image");
- $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png");
+ $log->logLine("Add Cover");
+ if (count($entries)>1){
+ $cover = "<h1>" . $entries[0]['title'] . " and " . count($entries) . " other articles</h1>";
+ } else {
+ $cover = "<h1>" . $entries[0]['title'] . "</h1>";
+ }
+ $book->setCover("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $cover);
+
- $cover = $content_start . "<h1>My articles on wallabag</h1>\n<h2>As seen on : http://$_SERVER[HTTP_HOST]</h2>\n" . $bookEnd;
- $book->addChapter("Notices", "Cover.html", $cover);
+ $book->setCover($cover);
+ //$book->addChapter("Notices", "Cover.html", $cover);
$book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE);
+ $subject = "";
foreach ($entries as $entry) {
$tags = $this->store->retrieveTagsByEntry($entry['id']);
foreach ($tags as $tag) {
- $book->setSubject($tag['value']);
+ $subject =. $tag['value'] . ',';
}
$log->logLine("Set up parameters");
-
-
$chapter = $content_start . $entry['content'] . $bookEnd;
$book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD);
+ $log->logLine("Added chapter " . $entry['title']);
}
-
+ $book->setSubject($subject);
if (DEBUG_POCHE) {
$epuplog = $book->getLog();