wp_imagecreatetruecolor

函数


wp_imagecreatetruecolor ( $width, $height )
参数
  • (int)
    $width
    Image width in pixels.
    Required:
  • (int)
    $height
    Image height in pixels.
    Required:
返回值
  • (resource|GdImage|false) The GD image resource or GdImage instance on success. False on failure.
定义位置
  • wp-includes/media.php
    , line 3764
引入
2.9.0
弃用

创建具有透明度支持的新的GD图像资源。

function wp_imagecreatetruecolor( $width, $height ) {
	$img = imagecreatetruecolor( $width, $height );

	if ( is_gd_image( $img )
		&& function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' )
	) {
		imagealphablending( $img, false );
		imagesavealpha( $img, true );
	}

	return $img;
}