From eceaec3df937fb4895502ad59a7d74858568aaed Mon Sep 17 00:00:00 2001 From: Christian Haschek Date: Mon, 28 Sep 2015 16:02:20 +0200 Subject: [PATCH] fixed messedup filename for non-cached images --- api.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api.php b/api.php index 38a4a2c..5a8bf30 100644 --- a/api.php +++ b/api.php @@ -45,7 +45,9 @@ switch ($type) { -$hash = 'c'.$cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$ft; +$hash = $cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$ft; +if(!$cache) + $hash = md5(time().rand(1,2000)).$hash; if(!is_dir(__DIR__.'/cache/')) mkdir(__DIR__.'/cache/'); @@ -90,7 +92,6 @@ imagedestroy($res); if(!$cache) unlink($file); - function isBase64($data) { if ( base64_encode(base64_decode($data, true)) === $data)