Summary:
PNG transparent resize with glitches
Detailed Description:
When I use CGSmartImage with PNG transparent, it's producing some black lines.
Original image:
https://dl.dropboxusercontent.com/u/11814293/Temp/CGSmartImage/logo.png
Resized by CGSmartImage:
https://dl.dropboxusercontent.com/u/11814293/Temp/CGSmartImage/img-69284182f53e36796b8a036025313046.png
Fixing this bug within class.CGImageBase.php, replacing:
// from supersizer
$_rsrc = imagecreatetruecolor($width, $height);
$color = imagecolorallocatealpha($_rsrc, 0, 0, 0, 127);
imagecolortransparent($_rsrc,$color);
$this->_transparent = $color;
return $_rsrc;
With (old code from previous CGSmartImage version):
// from supersizer
$_rsrc = imagecreatetruecolor($width, $height);
$color = imagecolorallocatealpha($_rsrc, 0, 0, 0, 127);
imagecolortransparent($_rsrc,$color);
// Turn off transparency blending (temporarily)
imagealphablending($_rsrc, false);
// Create a new transparent color for image
$color = imagecolorallocatealpha($_rsrc, 0, 0, 0, 127);
// Completely fill the background of the new image with allocated color.
imagefill($_rsrc, 0, 0, $color);
// Restore transparency blending
imagesavealpha($_rsrc, true);
$this->_transparent = $color;
return $_rsrc;