wp_imagecreatetruecolor

The timeline below displays how wordpress function wp_imagecreatetruecolor has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Creates a new GD image resource with transparency support.
 *
 * @todo Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width  Image width in pixels.
 * @param int $height Image height in pixels.
 * @return resource|GdImage|false The GD image resource or GdImage instance on success.
 *                                False on failure.
 */
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;
}

WordPress Version: 6.1

/**
 * Creates new GD image resource with transparency support.
 *
 * @todo Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width  Image width in pixels.
 * @param int $height Image height in pixels.
 * @return resource|GdImage|false The GD image resource or GdImage instance on success.
 *                                False on failure.
 */
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;
}

WordPress Version: 5.7

/**
 * Create new GD image resource with transparency support
 *
 * @todo Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width  Image width in pixels.
 * @param int $height Image height in pixels.
 * @return resource|GdImage|false The GD image resource or GdImage instance on success.
 *                                False on failure.
 */
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;
}

WordPress Version: 5.6

/**
 * Create new GD image resource with transparency support
 *
 * @todo Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width  Image width in pixels.
 * @param int $height Image height in pixels.
 * @return resource|GdImage|false The GD image resource or GdImage instance on success. False on failure.
 */
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;
}

WordPress Version: 5.4

/**
 * Create new GD image resource with transparency support
 *
 * @todo Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width  Image width in pixels.
 * @param int $height Image height in pixels..
 * @return resource The GD image resource.
 */
function wp_imagecreatetruecolor($width, $height)
{
    $img = imagecreatetruecolor($width, $height);
    if (is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
        imagealphablending($img, false);
        imagesavealpha($img, true);
    }
    return $img;
}

WordPress Version: 4.2

/**
 * Create new GD image resource with transparency support
 *
 * @todo: Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width  Image width in pixels.
 * @param int $height Image height in pixels..
 * @return resource The GD image resource.
 */
function wp_imagecreatetruecolor($width, $height)
{
    $img = imagecreatetruecolor($width, $height);
    if (is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
        imagealphablending($img, false);
        imagesavealpha($img, true);
    }
    return $img;
}

WordPress Version: 4.1

/**
 * Create new GD image resource with transparency support
 * @TODO: Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width Image width
 * @param int $height Image height
 * @return resource resource
 */
function wp_imagecreatetruecolor($width, $height)
{
    $img = imagecreatetruecolor($width, $height);
    if (is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
        imagealphablending($img, false);
        imagesavealpha($img, true);
    }
    return $img;
}

WordPress Version: 3.7

/**
 * Create new GD image resource with transparency support
 * @TODO: Deprecate if possible.
 *
 * @since 2.9.0
 *
 * @param int $width Image width
 * @param int $height Image height
 * @return image resource
 */
function wp_imagecreatetruecolor($width, $height)
{
    $img = imagecreatetruecolor($width, $height);
    if (is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
        imagealphablending($img, false);
        imagesavealpha($img, true);
    }
    return $img;
}