Handle Unknown Image Types Gracefully

This commit is contained in:
seiichiro 2022-02-11 17:13:20 +01:00
parent df4a36ecc5
commit dc91683b10
2 changed files with 5 additions and 0 deletions

BIN
img/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -45,6 +45,11 @@ class thumb {
if (!file_exists($dstpath)) {
$type = exif_imagetype($src);
if ($type == 0) {
error_log("$src: Unknown Image Type");
return "img/error.png";
}
$image = call_user_func(self::IMAGE_HANDLERS[$type]['load'], $src);
$srcwidth = imagesx($image);