mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
add pdf and mobi libraries
This commit is contained in:
parent
2b58426b2d
commit
4188f38ad5
297 changed files with 126557 additions and 7 deletions
28
inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php
vendored
Normal file
28
inc/3rdparty/libraries/send2kindle/MOBIClass/ImageHandler.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
class ImageHandler {
|
||||
/**
|
||||
* Download an image
|
||||
* @param string $url Url to the image
|
||||
* @return false|string False if failed, else the data of the image (converted to grayscale jpeg)
|
||||
*/
|
||||
public static function DownloadImage($url){
|
||||
$data = Http::Request($url);
|
||||
$imgFile = @imagecreatefromstring($data);
|
||||
|
||||
if($imgFile !== false){
|
||||
@imagefilter($imgFile, IMG_FILTER_GRAYSCALE);
|
||||
|
||||
ob_start();
|
||||
@imagejpeg($imgFile);
|
||||
$image = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
@imagedestroy($imgFile);
|
||||
|
||||
return $image;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue