From fb9df0c269f36703909b8b259abbdbed29881ecd Mon Sep 17 00:00:00 2001 From: tcit Date: Thu, 24 Jul 2014 21:56:04 +0200 Subject: use directly MOBIClass --- .../send2kindle/MOBIClass/PreprocessedArticle.php | 89 ---------------------- 1 file changed, 89 deletions(-) delete mode 100644 inc/3rdparty/libraries/send2kindle/MOBIClass/PreprocessedArticle.php (limited to 'inc/3rdparty/libraries/send2kindle/MOBIClass/PreprocessedArticle.php') diff --git a/inc/3rdparty/libraries/send2kindle/MOBIClass/PreprocessedArticle.php b/inc/3rdparty/libraries/send2kindle/MOBIClass/PreprocessedArticle.php deleted file mode 100644 index 2e992404..00000000 --- a/inc/3rdparty/libraries/send2kindle/MOBIClass/PreprocessedArticle.php +++ /dev/null @@ -1,89 +0,0 @@ -text = $textData; - $this->metadata = $metadata; - - $this->images = $this->downloadImages($imageLinks); - } - - /** - * Create a Preprocessed article from a json string - * @param string $json JSON data. Should be of the following format: - * {"text": "TEXT", "images: ["imageURL1", "imageURL2"], "metadata": {"key": "value"}} - * - * Note: Any image tags should have the recindex attribute set to the appropriate index (the - * same index as the image in the array) - * @return PreprocessedArticle The generated preprocessed array - */ - static public function CreateFromJson($json){ - $data = json_decode($json); - return new PreprocessedArticle($data["text"], $data["images"], $data["metadata"]); - } - - /** - * Get the text data to be integrated in the MOBI file - * @return string - */ - public function getTextData(){ - return $this->text; - } - /** - * Get the images (an array containing the jpeg data). Array entry 0 will - * correspond to image record 0. - * @return array - */ - public function getImages(){ - return $this->images; - } - /** - * Get the metadata in the form of a hashtable (for example, title or author). - * @return array - */ - public function getMetaData(){ - return $this->metadata; - } - /** - * - * @param DOMElement $dom - * @return array - */ - private function downloadImages($links){ - $images = array(); - foreach($links as $link) { - $imgFile = @imagecreatefromstring(Http::Request($link)); - - if($imgFile === false){ - $imgFile = @imagecreate(1, 1); - $black = @imagecolorallocate($imgFile, 255, 255, 255); - } - if($imgFile !== false){ - @imagefilter($imgFile, IMG_FILTER_GRAYSCALE); - - ob_start(); - @imagejpeg($imgFile); - $image = ob_get_contents(); - ob_end_clean(); - - $images[$this->imgCounter] = new FileRecord(new Record($image)); - imagedestroy($imgFile); - - $this->imgCounter++; - } - } - - return $images; - } -} -?> -- cgit v1.2.3