From d2c309aee8189a5d6c2a3fcb0a05ea694d7b646e Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 11 Sep 2014 17:35:15 +0200 Subject: Fix black background in thumbnails with transparency Signed-off-by: Florian Pritz --- application/models/mfile.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/models/mfile.php b/application/models/mfile.php index 427c74a18..1f5409ec3 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -126,6 +126,8 @@ class Mfile extends CI_Model { if ($source_gdim === false) { show_error("Unsupported image type"); } + imagealphablending($source_gdim,false); + imagesavealpha($source_gdim,true); list($source_width, $source_height, $source_type) = getimagesize($source_path); @@ -154,6 +156,8 @@ class Mfile extends CI_Model { */ $temp_gdim = imagecreatetruecolor($temp_width, $temp_height); + imagealphablending($temp_gdim,false); + imagesavealpha($temp_gdim,true); imagecopyresampled( $temp_gdim, $source_gdim, @@ -170,6 +174,8 @@ class Mfile extends CI_Model { $x0 = ($temp_width - $target_width) / 2; $y0 = ($temp_height - $target_height) / 2; $thumb = imagecreatetruecolor($target_width, $target_height); + imagealphablending($thumb,false); + imagesavealpha($thumb,true); imagecopy( $thumb, $temp_gdim, -- cgit v1.2.3-24-g4f1b