Make WordPress Core

Changeset 6439


Ignore:
Timestamp:
12/20/2007 10:24:39 PM (16 years ago)
Author:
westi
Message:

Preserve PNG transparency/alpha during thumbnail creation. Fixes #2805 props Libertus/Otto42.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image.php

    r6438 r6439  
    3434
    3535    $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);
     36
     37    // preserve PNG transparency
     38    if( IMAGETYPE_PNG == $sourceImageType && function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' )) {
     39        imagealphablending($thumbnail, false);
     40        imagesavealpha($thumbnail,true);
     41    }   
     42   
    3643    @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $sourceImageWidth, $sourceImageHeight );
    3744
Note: See TracChangeset for help on using the changeset viewer.