wpseek.com
WordPress开发者和主题制作者的搜索引擎



is_gd_image › WordPress Function

Since5.6.0
已弃用n/a
is_gd_image ( $image )
参数:
  • (resource|GdImage|false) $image A value to check the type for.
    Required: Yes
返回:
  • (bool) True if `$image` is either a GD image resource or a GdImage instance, false otherwise.
定义在:
文档:

Determines whether the value is an acceptable type for GD image functions.

In PHP 8.0, the GD extension uses GdImage objects for its data structures. This function checks if the passed value is either a GdImage object instance or a resource of type gd. Any other type will return false.


源码

function is_gd_image( $image ) {
	if ( $image instanceof GdImage
		|| is_resource( $image ) && 'gd' === get_resource_type( $image )
	) {
		return true;
	}

	return false;
}