thumb: catch php errors during (gd) resize
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 6 Jul 2018 22:16:26 +0000 (00:16 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 7 Jul 2018 11:42:39 +0000 (13:42 +0200)
Image response if GD fails on PHP 7, making it behave identical to exec.
Incompatible with PHP 5, where it will show a generic html error page,
regressing for convert exceptions.

thumb/index.php

index 532499f6aa2f14f3cd2f4aea9dbd7481ae9feea5..1d369488c927b78399d9a2e208559286a109c595 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)) {