diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-19 13:37:32 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-19 13:37:32 +0100 |
commit | 3d99ce9dadca82765832ab669dabc22c554fd78e (patch) | |
tree | e47e84483e03ccc289bf5768526dedacdff07add /inc/3rdparty/libraries/MOBIClass/ImageHandler.php | |
parent | 99410a21eb261f50234cc4148323a52b345e15e1 (diff) | |
download | wallabag-3d99ce9dadca82765832ab669dabc22c554fd78e.tar.gz wallabag-3d99ce9dadca82765832ab669dabc22c554fd78e.tar.zst wallabag-3d99ce9dadca82765832ab669dabc22c554fd78e.zip |
travis configuration
Diffstat (limited to 'inc/3rdparty/libraries/MOBIClass/ImageHandler.php')
-rw-r--r-- | inc/3rdparty/libraries/MOBIClass/ImageHandler.php | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/inc/3rdparty/libraries/MOBIClass/ImageHandler.php b/inc/3rdparty/libraries/MOBIClass/ImageHandler.php deleted file mode 100644 index bcb48e9f..00000000 --- a/inc/3rdparty/libraries/MOBIClass/ImageHandler.php +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
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 | $result = self::CreateImage($imgFile); | ||
15 | imagedestroy($imgFile); | ||
16 | return $result; | ||
17 | } | ||
18 | return false; | ||
19 | } | ||
20 | /** | ||
21 | * Create an image | ||
22 | * @param resource $img Create an image created with createimagetruecolor | ||
23 | * @return false|string False if failed, else the data of the image (converted to grayscale jpeg) | ||
24 | */ | ||
25 | public static function CreateImage($img){ | ||
26 | try{ | ||
27 | imagefilter($img, IMG_FILTER_GRAYSCALE); | ||
28 | |||
29 | ob_start(); | ||
30 | imagejpeg($img); | ||
31 | $image = ob_get_contents(); | ||
32 | ob_end_clean(); | ||
33 | |||
34 | return $image; | ||
35 | }catch(Exception $e){ | ||
36 | return false; | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | ?> | ||