wp_load_image
函数
wp_load_image ( $file )
- 参数
-
-
(string)
$file
Filename of the image to load.- Required: 是
-
(string)
- 返回值
-
- (resource|GdImage|string) The resulting image resource or GdImage instance on success, error string on failure.
- 相关
-
- wp_get_image_editor()
- 定义位置
-
-
wp-includes/deprecated.php
, line 3187
-
wp-includes/deprecated.php
- 引入
- 2.1.0
- 弃用
- 3.5.0
Load an image from a string, if PHP supports it.
function wp_load_image( $file ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); if ( is_numeric( $file ) ) $file = get_attached_file( $file ); if ( ! is_file( $file ) ) { /* translators: %s: File name. */ return sprintf( __( 'File “%s” does not exist?' ), $file ); } if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); // Set artificially high because GD uses uncompressed images in memory. wp_raise_memory_limit( 'image' ); $image = imagecreatefromstring( file_get_contents( $file ) ); if ( ! is_gd_image( $image ) ) { /* translators: %s: File name. */ return sprintf( __( 'File “%s” is not an image.' ), $file ); } return $image; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。