gd_edit_image_support()
最后更新于:2021-11-26 04:09:57
gd_edit_image_support( string$mime_type)Check if the installed version of GD supports particular image type
参数
- $mime_type
-
(string) (Required)
响应
(bool)
源文件
文件: gc-includes/deprecated.php
function gd_edit_image_support($mime_type) {
_deprecated_function( __FUNCTION__, '3.5.0', 'gc_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; // phpcs:ignore PHPCompatibility.Constants.NewConstants.img_webpFound
}
} 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;
}