X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/9a24b86c2c7ddd574bf21ad86877c9c3bf0f229e..f08646f0f4d2dfe6ba6d4804e0439777c3eb8f77:/thumb/index.php diff --git a/thumb/index.php b/thumb/index.php index 1267919..2849bb5 100644 --- a/thumb/index.php +++ b/thumb/index.php @@ -13,9 +13,8 @@ if (!file_exists($imgpath)) { } } -$target = "thumb/$height/$imgpath"; try { - mkthumb($imgpath, $target, $width, $height); + $target = mkthumb($imgpath, $width, $height); } catch (Exception $e) { http_response_code($e->getCode() ?: 500); @@ -34,8 +33,10 @@ header('Content-type: '.mime_content_type($target)); 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']; } @@ -49,6 +50,7 @@ function mkthumb($source, $target, $width, $height) @mkdir(dirname($target), 0777, TRUE); $backend($source, $target, $width, $height); + return $target; } function mkthumb_exec($source, $target, $width, $height)