thumb: output results of existing target
[minimedit.git] / thumb / index.php
index 532499f6aa2f14f3cd2f4aea9dbd7481ae9feea5..d662b5ffa2f26a29cd4620f294e56c11fddaff40 100644 (file)
@@ -16,7 +16,7 @@ if (!file_exists($imgpath)) {
 try {
        $target = mkthumb($imgpath, $width, $height);
 }
-catch (Exception $e) {
+catch (Throwable $e) {
        http_response_code($e->getCode() ?: 500);
        $target = '500.png';
        if (file_exists($target)) {
@@ -41,7 +41,7 @@ function mkthumb($source, $width, $height)
                $backend = $_GET['backend'];
        }
        elseif (file_exists($target)) {
-               return;
+               return $target;
        }
        elseif (extension_loaded('gd')) {
                $backend = 'gd';