[wp-trac] [WordPress Trac] #13461: Preserve GIF transparency/alpha during thumbnail creation

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 3 16:26:18 UTC 2010


#13461: Preserve GIF transparency/alpha during thumbnail creation
--------------------------+-------------------------------------------------
 Reporter:  javitxu123    |       Owner:                  
     Type:  defect (bug)  |      Status:  new             
 Priority:  normal        |   Milestone:  Future Release  
Component:  Media         |     Version:  2.9.2           
 Severity:  normal        |    Keywords:  needs-patch gsoc
--------------------------+-------------------------------------------------

Comment(by linguasite):

 Here's a little patch that helps at least keeping the appearence in most
 cases. It doesn't preserve the tranparency though but sets the black
 background in the image to transparent just before the thumbnail is
 created.

 ''/wp-includes/media.php'' line 422:

 {{{
 $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );

 if(IMAGETYPE_GIF == $orig_type){
         $black=imagecolorallocate($image, 0,0,0);
         imagecolortransparent($image, $black);
 }

 imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y,
 $dst_w, $dst_h, $src_w, $src_h);
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13461#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list