Un motore di ricerca WordPress per sviluppatori e autori di temi



gd_edit_image_support ›

Da2.9.0
Deprecato3.5.0
gd_edit_image_support ( $mime_type )
Parametri:
  • (string) $mime_type
    Richiesto:
Vedi:
Ritorna:
  • (bool)
Definito a:
Codex:

Check if the installed version of GD supports particular image type



Sorgenti

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;
		}
	} 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');
		}
	}
	return false;
}