Skip to content
Browse files

Transparent PNG to JPG will convert transparent pixels to white, inst…

…ead of black
  • Loading branch information...
1 parent 13ccf15 commit 718b6aabc2efde02a654707a788285b1f87fe35c @maikeldaloo committed Nov 27, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 resizer.php
View
4 resizer.php
@@ -101,6 +101,10 @@ public function resize( $new_width , $new_height , $option = 'auto' )
imagealphablending( $this->image_resized , false );
imagesavealpha( $this->image_resized , true );
+ // convert transparency to white when converting from PNG to JPG.
+ // PNG to PNG should retain transparency as per normal.
+ imagefill( $this->image_resized , 0 , 0 , IMG_COLOR_TRANSPARENT );
+
// Create the new image.
imagecopyresampled( $this->image_resized , $this->image , 0 , 0 , 0 , 0 , $optimal_width , $optimal_height , $this->width , $this->height );

0 comments on commit 718b6aa

Please sign in to comment.
Something went wrong with that request. Please try again.