Handle Unknown Image Types Gracefully
This commit is contained in:
parent
df4a36ecc5
commit
dc91683b10
2 changed files with 5 additions and 0 deletions
BIN
img/error.png
Normal file
BIN
img/error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -45,6 +45,11 @@ class thumb {
|
||||||
|
|
||||||
if (!file_exists($dstpath)) {
|
if (!file_exists($dstpath)) {
|
||||||
$type = exif_imagetype($src);
|
$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);
|
$image = call_user_func(self::IMAGE_HANDLERS[$type]['load'], $src);
|
||||||
|
|
||||||
$srcwidth = imagesx($image);
|
$srcwidth = imagesx($image);
|
||||||
|
|
Loading…
Reference in a new issue