Warning: This function has been deprecated. Use wp_image_editor_supports() instead.

gd_edit_image_support() WordPress Function

The gd_edit_image_support() function allows you to edit images within WordPress. This function can be used to crop, resize, and edit images within WordPress.

gd_edit_image_support( string $mime_type ) #

Check if the installed version of GD supports particular image type


Description

Top ↑

See also


Top ↑

Parameters

$mime_type

(string)(Required)


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/deprecated.php

function gd_edit_image_support($mime_type) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' );

	if ( function_exists('imagetypes') ) {
		switch( $mime_type ) {
			case 'image/jpeg':
				return (imagetypes() & IMG_JPG) != 0;
			case 'image/png':
				return (imagetypes() & IMG_PNG) != 0;
			case 'image/gif':
				return (imagetypes() & IMG_GIF) != 0;
			case 'image/webp':
				return (imagetypes() & IMG_WEBP) != 0;
		}
	} else {
		switch( $mime_type ) {
			case 'image/jpeg':
				return function_exists('imagecreatefromjpeg');
			case 'image/png':
				return function_exists('imagecreatefrompng');
			case 'image/gif':
				return function_exists('imagecreatefromgif');
			case 'image/webp':
				return function_exists('imagecreatefromwebp');
		}
	}
	return false;
}


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Use wp_image_editor_supports()
2.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More