X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/f0854fdec506a219e5c92c2453fcb2eff76a8dc9..af49d9b508825f62a0ea80c9069dd32d1147b433:/thumb/index.php diff --git a/thumb/index.php b/thumb/index.php index d662b5f..24f46cc 100644 --- a/thumb/index.php +++ b/thumb/index.php @@ -1,8 +1,7 @@ getCode() ?: 500); @@ -33,9 +32,21 @@ 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']; @@ -80,7 +91,7 @@ function mkthumb_exec($source, $target, $width, $height) '-trim', '-resize', "${width}x${height}", '-quality', '90%', - $source, $target + $source, "jpg:$target" ])); $return = shell_exec("$cmd 2>&1"); if ($return) {