diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-09-11 17:35:15 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-09-11 17:35:15 +0200 |
commit | d2c309aee8189a5d6c2a3fcb0a05ea694d7b646e (patch) | |
tree | 148e6de344b0dce59f3fa8d18124385d09a24621 /application/models | |
parent | ee8521d64be99b51337728060ebc59bdcd1442f7 (diff) |
Fix black background in thumbnails with transparency
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models')
-rw-r--r-- | application/models/mfile.php | 6 |
1 files changed, 6 insertions, 0 deletions
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, |