Preserve alpha in WP_Image_Editor_GD when images are not resized.

Props joehoyle
see #23039


git-svn-id: https://develop.svn.wordpress.org/trunk@23884 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2013-04-01 15:21:19 +00:00
parent 311d7429d0
commit c0e42b5666
1 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,11 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
if ( ! $size )
return new WP_Error( 'invalid_image', __('Could not read image size.'), $this->file );
if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
imagealphablending( $this->image, false );
imagesavealpha( $this->image, true );
}
$this->update_size( $size[0], $size[1] );
$this->mime_type = $size['mime'];