//Starting with PHP 8.0, get_resource_type or is_resource with a GD image argument,
//will throw a Fatal Error, we should use get_class
function is_gd_image($var) : bool {
return (gettype($var) == "object" && get_class($var) == "GdImage");
}