On this page
wp_imagecreatetruecolor( int $width, int $height ): resource|GdImage|false
Creates new GD image resource with transparency support.
Parameters
$widthint Required-
Image width in pixels.
$heightint Required-
Image height in pixels.
Return
resource|GdImage|false The GD image resource or GdImage instance on success.
False on failure.
Source
File: wp-includes/media.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| is_gd_image() wp-includes/media.php | Determines whether the value is an acceptable type for GD image functions. |
Used By
| Used By | Description |
|---|---|
| WP_Image_Editor_GD::_resize() wp-includes/class-wp-image-editor-gd.php | |
| WP_Image_Editor_GD::crop() wp-includes/class-wp-image-editor-gd.php | Crops Image. |
| WP_Image_Editor_GD::flip() wp-includes/class-wp-image-editor-gd.php | Flips current image. |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_imagecreatetruecolor