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_create_userwp_create_termwp_image_editorwpmu_create_userwp_create_category
引入
2.9.0
弃用
-

wp_imagecreatetruecolor: 这个函数用来创建一个具有指定宽度和高度的新真彩色图像资源。它接收两个参数,即图像的宽度和高度,并返回图像资源。

创建具有透明度支持的新的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;
}

常见问题

FAQs
查看更多 >