gd_edit_image_support() - WordPress 函数参考中文文档

返回介绍

gd_edit_image_support()

发布于 2017-09-10 字数1733 浏览 912 评论 0

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

gd_edit_image_support( string $mime_type )

Check if the installed version of GD supports particular image type


描述


参数

$mime_type

(string)
(Required)


返回值

(bool)


源代码

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;
		}
	} 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;
}

更新日志

Version 描述
3.5.0 Use wp_image_editor_supports()
2.9.0 Introduced.

相关函数

Uses

  • wp-includes/functions.php:
    _deprecated_function()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!