From: Michael Vogel Date: Sun, 17 Feb 2013 11:37:32 +0000 (+0100) Subject: privacy_image_cache: Only compress files that aren't GIFs X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=01292c59edc63333a4eed368f953df46c7fc6d7b;p=friendica-addons.git privacy_image_cache: Only compress files that aren't GIFs --- diff --git a/privacy_image_cache/privacy_image_cache.php b/privacy_image_cache/privacy_image_cache.php index 30155fab..d228a734 100644 --- a/privacy_image_cache/privacy_image_cache.php +++ b/privacy_image_cache/privacy_image_cache.php @@ -48,9 +48,6 @@ function privacy_image_cache_init() { exit; } - //if ($a->config["system"]["db_log"] != "") - // $stamp1 = microtime(true); - if(function_exists('header_remove')) { header_remove('Pragma'); header_remove('pragma'); @@ -169,10 +166,12 @@ function privacy_image_cache_init() { //$mime = "image/jpeg"; } } - - $img = new Photo($img_str, $mime); - if($img->is_valid()) - $img_str = $img->imageString(); + // reduce quality - if it isn't a GIF + if ($mime != "image/gif") { + $img = new Photo($img_str, $mime); + if($img->is_valid()) + $img_str = $img->imageString(); + } // If there is a real existing directory then put the cache file there // advantage: real file access is really fast @@ -199,7 +198,9 @@ function privacy_image_cache_init() { function privacy_image_cache_cachename($url, $writemode = false) { global $_SERVER; - +// echo $url; +// $mime = image_type_to_mime_type(exif_imagetype($url)); +// echo $mime; $basepath = $_SERVER["DOCUMENT_ROOT"]."/privacy_image_cache"; $path = substr(hash("md5", $url), 0, 2);