From c38a5f3c0dfe2f6b6e6d51691a7b458f93f4212f Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Sat, 12 Jun 2021 11:16:27 +0200 Subject: [PATCH] Test if thumbnail is GdImage In PHP 8, GD returns GdImage objects and not resources. To check if a thumbnail could be created, `is_resource()` was used. Since the thumbnail is no longer a resource, this check now fails and the default thumbnail was used for all maps. See https://php.watch/versions/8.0/gdimage#gdimage-is-resource --- src/include/image_is_resizable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/image_is_resizable.php b/src/include/image_is_resizable.php index 526db23..f0ea2ea 100644 --- a/src/include/image_is_resizable.php +++ b/src/include/image_is_resizable.php @@ -5,11 +5,11 @@ if(file_exists($filename)) { $image = Helper::ImageCreateFromGeneral($filename); - if(is_resource($image)) + if(is_resource($image) || $image instanceof \GdImage) { ImageDestroy($image); $result = 1; } } print $result; -?> \ No newline at end of file +?>