}
}
-$target = "thumb/$height/$imgpath";
try {
- mkthumb($imgpath, $target, $width, $height);
+ $target = mkthumb($imgpath, $width, $height);
}
catch (Exception $e) {
http_response_code($e->getCode() ?: 500);
readfile($target);
exit;
-function mkthumb($source, $target, $width, $height)
+function mkthumb($source, $width, $height)
{
+ $target = "thumb/$height/$source";
+
if (isset($_GET['backend'])) {
$backend = $_GET['backend'];
}
@mkdir(dirname($target), 0777, TRUE);
$backend($source, $target, $width, $height);
+ return $target;
}
function mkthumb_exec($source, $target, $width, $height)