From 8dceb8e3a75282540d7dbe9dc6e26091dad71fe0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 21 Nov 2017 14:30:26 -0800 Subject: thumbnail generator for epubs --- Zotlabs/Thumbs/Epubthumb.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Zotlabs/Thumbs/Epubthumb.php (limited to 'Zotlabs/Thumbs') diff --git a/Zotlabs/Thumbs/Epubthumb.php b/Zotlabs/Thumbs/Epubthumb.php new file mode 100644 index 000000000..4213b5267 --- /dev/null +++ b/Zotlabs/Thumbs/Epubthumb.php @@ -0,0 +1,38 @@ +Cover(); + + if($data['found']) { + $photo = $data['data']; + } + + if($photo) { + $image = imagecreatefromstring($photo); + $dest = imagecreatetruecolor( $width, $height ); + $srcwidth = imagesx($image); + $srcheight = imagesy($image); + + imagealphablending($dest, false); + imagesavealpha($dest, true); + imagecopyresampled($dest, $image, 0, 0, 0, 0, $width, $height, $srcwidth, $srcheight); + imagedestroy($image); + imagejpeg($dest,dbunescbin($attach['content']) . '.thumb'); + } + } +} + -- cgit v1.2.3