X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/c7b3d1c8dddb7c64b15ec7bcec2f2e3b9c9cbfb6..e15f27487946afb29f3f846dd96edd1fb65e3f44:/thumb/index.php diff --git a/thumb/index.php b/thumb/index.php index 1d36948..2a8e303 100644 --- a/thumb/index.php +++ b/thumb/index.php @@ -1,8 +1,7 @@ getCode() ?: 500); @@ -33,15 +32,27 @@ header('Content-type: '.mime_content_type($target)); readfile($target); exit; -function mkthumb($source, $width, $height) +function mkthumb($source, $size) { - $target = "thumb/$height/$source"; + if (strpos($size, 'x') !== FALSE) { + list ($width, $height) = explode('x', $size); + if (empty($height)) { + $height = $width * 4; + } + } + else { + $height = $size; + } + if (empty($width)) { + $width = $height * 4; + } + $target = "thumb/$size/$source"; if (isset($_GET['backend'])) { $backend = $_GET['backend']; } elseif (file_exists($target)) { - return; + return $target; } elseif (extension_loaded('gd')) { $backend = 'gd';