is_gd_image( resource|GdImage|false $image ): bool

In this article

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

Description

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.

Parameters

$imageresource|GdImage|falserequired
A value to check the type for.

Return

bool True if $image is either a GD image resource or a GdImage instance, false otherwise.

Source


if ( ! empty( $attachment->post_mime_type ) ) {
	$objects[] = 'attachment:' . $attachment->post_mime_type;

	if ( str_contains( $attachment->post_mime_type, '/' ) ) {
		foreach ( explode( '/', $attachment->post_mime_type ) as $token ) {
			if ( ! empty( $token ) ) {
				$objects[] = "attachment:$token";
			}

Changelog

VersionDescription
5.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.