Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- library/core/class.uploadimage.php.orig 2010-07-18 13:01:24.000000000 +0200
- +++ library/core/class.uploadimage.php 2010-07-18 13:24:30.000000000 +0200
- @@ -137,10 +137,24 @@
- throw new Exception(sprintf(T('You cannot save images of this type (%s).'), $Type));
- // Create a new image from the raw source
- - if (function_exists('imagecreatetruecolor'))
- + if (function_exists('imagecreatetruecolor')) {
- $TargetImage = imagecreatetruecolor($Width, $Height); // Only exists if GD2 is installed
- - else
- +
- + // define the background color (white or transparent)
- + imagesavealpha($TargetImage, true);
- + imagealphablending($TargetImage, true);
- + if ($OutputType == 'png') {
- + // background color is transparent
- + $bg_color = imagecolortransparent($TargetImage, imagecolorallocatealpha($TargetImage, 0, 0, 0, 127)); // transparent
- + imagesavealpha($TargetImage, true);
- + } else {
- + // background color is white
- + $bg_color = imagecolorallocate($TargetImage, 255, 255, 255);
- + }
- + imagefill($TargetImage, 0, 0, $bg_color);
- + } else {
- $TargetImage = imagecreate($Width, $Height); // Always exists if any GD is installed
- + }
- imagecopyresampled($TargetImage, $SourceImage, 0, 0, $XCoord, $YCoord, $Width, $Height, $WidthSource, $HeightSource);
- imagedestroy($SourceImage);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement