]> git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php
add pdf and mobi libraries
[github/wallabag/wallabag.git] / inc / 3rdparty / libraries / send2kindle / MOBIClass / ImageHandler.php
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 ?>