]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/3rdparty/libraries/PHPePub/EPub.php
add mobi and pdf to routing
[github/wallabag/wallabag.git] / inc / 3rdparty / libraries / PHPePub / EPub.php
index e120b3413c344ce8c9da945ddf01d9d2150a296a..d9b990b7a8a03afe47f5039b1d2382db76866fad 100644 (file)
@@ -41,6 +41,8 @@ class EPub {
 
     private $bookVersion = EPub::BOOK_VERSION_EPUB2;
 
+    private $debugInside = FALSE;
+
        public $maxImageWidth = 768;
     public $maxImageHeight = 1024;
 
@@ -132,10 +134,14 @@ class EPub {
      *
      * @return void
      */
-    function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) {
+    function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $debugInside = FALSE, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) {
         include_once("Zip.php");
                include_once("Logger.php");
 
+        if (!$debugInside) {
+            error_reporting(E_ERROR | E_PARSE);
+        }
+
                $this->bookVersion = $bookVersion;
                $this->writingDirection = $writingDirection;
                $this->languageCode = $languageCode;
@@ -574,7 +580,7 @@ class EPub {
      * @param string $mimetype Image mimetype, such as "image/jpeg" or "image/png".
      * @return bool $success
      */
-    function setCover($fileName, $imageData = NULL, $mimetype = NULL, $coverText=NULL) {
+    function setCoverImage($fileName, $imageData = NULL, $mimetype = NULL,$bookTitle) {
         if ($this->isFinalized || $this->isCoverImageSet || array_key_exists("CoverPage.html", $this->fileList)) {
             return FALSE;
         }
@@ -621,13 +627,13 @@ class EPub {
                                . "<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</title>\n"
+                               . "\t\t<title>Cover Image</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" . $bookTitle . "\n"
                                . "\t\t<div>\n"
-                               . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 40%\"/>\n"
+                               . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 100%\"/>\n"
                                . "\t\t</div>\n"
                                . "\t</body>\n"
                                . "</html>\n";
@@ -636,13 +642,13 @@ class EPub {
                                . "<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</title>\n"
+                               . "\t\t<title>Cover Image</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" . $coverText . "\n"
-                               . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 40%\"/>\n"
+                . "\t" . $bookTitle . "\n"
+                               . "\t\t\t<img src=\"" . $imgPath . "\" alt=\"Cover image\" style=\"height: 30%\"/>\n"
                                . "\t\t</section>\n"
                                . "\t</body>\n"
                                . "</html>\n";