wp_imagecreatetruecolor

Create new GD image resource with transparency support.

Description

(resource) wp_imagecreatetruecolor( (int) $width, (int) $height ); 

Returns (resource)

The GD image resource.

Parameters (2)

0. $width (int)
Image width in pixels.
1. $height (int)
Image height in pixels..

Usage

  1. if ( !function_exists( 'wp_imagecreatetruecolor' ) ) { 
  2. require_once ABSPATH . WPINC . '/media.php'; 
  3.  
  4. // Image width in pixels. 
  5. $width = -1; 
  6.  
  7. // Image height in pixels.. 
  8. $height = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wp_imagecreatetruecolor($width, $height); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/media.php  
  1. function wp_imagecreatetruecolor($width, $height) { 
  2. $img = imagecreatetruecolor($width, $height); 
  3. if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) { 
  4. imagealphablending($img, false); 
  5. imagesavealpha($img, true); 
  6. return $img;