From a51de98781eb70df0455b9fe98d7db95e66acf8c Mon Sep 17 00:00:00 2001 From: Christian Haschek Date: Mon, 28 Sep 2015 15:56:04 +0200 Subject: [PATCH] if the user didn't specify the cache id, we'll delete the image and not keep it --- api.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api.php b/api.php index a51824e..38a4a2c 100644 --- a/api.php +++ b/api.php @@ -45,9 +45,7 @@ switch ($type) { -if(!$cache) - $cache = md5(time().rand(1,2000)); -$hash = $cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$ft; +$hash = 'c'.$cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$ft; if(!is_dir(__DIR__.'/cache/')) mkdir(__DIR__.'/cache/'); @@ -89,6 +87,9 @@ else if($ft=='png') imagedestroy($res); +if(!$cache) + unlink($file); + function isBase64($data) {