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影象資源。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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
檢視更多 >