Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ead of black
  • Loading branch information...
commit 718b6aabc2efde02a654707a788285b1f87fe35c 1 parent 13ccf15
@maikeldaloo authored
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 );
Please sign in to comment.
Something went wrong with that request. Please try again.