diff options
author | tcit <tcit@tcit.fr> | 2014-07-24 15:49:36 +0200 |
---|---|---|
committer | tcit <tcit@tcit.fr> | 2014-07-24 15:49:36 +0200 |
commit | 4188f38ad56d7ba2ea46e94403f305243514f80c (patch) | |
tree | f357ddbd0d846ebae0ecf5d2ab00d6b7dd6eb8d5 /inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php | |
parent | 2b58426b2d4a7f1585d5d7667c0a4fbea4cd29dd (diff) | |
download | wallabag-4188f38ad56d7ba2ea46e94403f305243514f80c.tar.gz wallabag-4188f38ad56d7ba2ea46e94403f305243514f80c.tar.zst wallabag-4188f38ad56d7ba2ea46e94403f305243514f80c.zip |
add pdf and mobi libraries
Diffstat (limited to 'inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php')
-rw-r--r-- | inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php b/inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php new file mode 100644 index 00000000..f620fc1f --- /dev/null +++ b/inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php | |||
@@ -0,0 +1,28 @@ | |||
1 | <?php | ||
2 | |||
3 | class ImageHandler { | ||
4 | /** | ||
5 | * Download an image | ||
6 | * @param string $url Url to the image | ||
7 | * @return false|string False if failed, else the data of the image (converted to grayscale jpeg) | ||
8 | */ | ||
9 | public static function DownloadImage($url){ | ||
10 | $data = Http::Request($url); | ||
11 | $imgFile = @imagecreatefromstring($data); | ||
12 | |||
13 | if($imgFile !== false){ | ||
14 | @imagefilter($imgFile, IMG_FILTER_GRAYSCALE); | ||
15 | |||
16 | ob_start(); | ||
17 | @imagejpeg($imgFile); | ||
18 | $image = ob_get_contents(); | ||
19 | ob_end_clean(); | ||
20 | |||
21 | @imagedestroy($imgFile); | ||
22 | |||
23 | return $image; | ||
24 | } | ||
25 | return false; | ||
26 | } | ||
27 | } | ||
28 | ?> | ||