WordPress.org

Make WordPress Core

Ticket #13461: 13461.4.patch

File 13461.4.patch, 1.4 KB (added by SergeyBiryukov, 8 years ago)
  • wp-includes/media.php

     
    395395/**
    396396 * Scale down an image to fit a particular size and save a new copy of the image.
    397397 *
    398  * The PNG transparency will be preserved using the function, as well as the
     398 * The PNG and GIF transparency will be preserved using the function, as well as the
    399399 * image type. If the file going in is PNG, then the resized image is going to
    400400 * be PNG. The only supported image types are PNG, GIF, and JPEG.
    401401 *
     
    10211021 * @param int $height Image height
    10221022 * @return image resource
    10231023 */
    1024 function wp_imagecreatetruecolor($width, $height) {
    1025         $img = imagecreatetruecolor($width, $height);
    1026         if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
    1027                 imagealphablending($img, false);
    1028                 imagesavealpha($img, true);
     1024function wp_imagecreatetruecolor( $width, $height ) {
     1025        $img = imagecreatetruecolor( $width, $height );
     1026        if ( is_resource( $img ) && function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
     1027                if ( function_exists( 'imagecolortransparent' ) && function_exists( 'imagecolorallocatealpha' ) )
     1028                        imagecolortransparent( $img, imagecolorallocatealpha( $img, 0, 0, 0, 127 ) );
     1029                imagealphablending( $img, false );
     1030                imagesavealpha( $img, true );
    10291031        }
    10301032        return $img;
    10311033}