mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-20 14:53:43 +00:00
privacy_image_cache: Only compress files that aren't GIFs
This commit is contained in:
parent
a24880dcc1
commit
01292c59ed
1 changed files with 9 additions and 8 deletions
|
@ -48,9 +48,6 @@ function privacy_image_cache_init() {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($a->config["system"]["db_log"] != "")
|
|
||||||
// $stamp1 = microtime(true);
|
|
||||||
|
|
||||||
if(function_exists('header_remove')) {
|
if(function_exists('header_remove')) {
|
||||||
header_remove('Pragma');
|
header_remove('Pragma');
|
||||||
header_remove('pragma');
|
header_remove('pragma');
|
||||||
|
@ -169,10 +166,12 @@ function privacy_image_cache_init() {
|
||||||
//$mime = "image/jpeg";
|
//$mime = "image/jpeg";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// reduce quality - if it isn't a GIF
|
||||||
$img = new Photo($img_str, $mime);
|
if ($mime != "image/gif") {
|
||||||
if($img->is_valid())
|
$img = new Photo($img_str, $mime);
|
||||||
$img_str = $img->imageString();
|
if($img->is_valid())
|
||||||
|
$img_str = $img->imageString();
|
||||||
|
}
|
||||||
|
|
||||||
// If there is a real existing directory then put the cache file there
|
// If there is a real existing directory then put the cache file there
|
||||||
// advantage: real file access is really fast
|
// advantage: real file access is really fast
|
||||||
|
@ -199,7 +198,9 @@ function privacy_image_cache_init() {
|
||||||
|
|
||||||
function privacy_image_cache_cachename($url, $writemode = false) {
|
function privacy_image_cache_cachename($url, $writemode = false) {
|
||||||
global $_SERVER;
|
global $_SERVER;
|
||||||
|
// echo $url;
|
||||||
|
// $mime = image_type_to_mime_type(exif_imagetype($url));
|
||||||
|
// echo $mime;
|
||||||
$basepath = $_SERVER["DOCUMENT_ROOT"]."/privacy_image_cache";
|
$basepath = $_SERVER["DOCUMENT_ROOT"]."/privacy_image_cache";
|
||||||
|
|
||||||
$path = substr(hash("md5", $url), 0, 2);
|
$path = substr(hash("md5", $url), 0, 2);
|
||||||
|
|
Loading…
Reference in a new issue