Hi all!
For all of you that want to preserve the transparency of images, I added this function:
Code:
function setTransparency($new,$temp)
{
$transparencyIndex = imagecolortransparent($temp);
$transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255);
if ($transparencyIndex >= 0) {
$transparencyColor = imagecolorsforindex($temp, $transparencyIndex);
}
$transparencyIndex = imagecolorallocate($new, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']);
imagefill($new, 0, 0, $transparencyIndex);
imagecolortransparent($new, $transparencyIndex);
}
You can call it with setTransparency($new,$temp);
just before imagecopyresampled($new, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $org_w, $org_h);
Thank you very much to Boudewijn for this fantastic mod. For next reviews, it must have a direct link at the product edit screen. anybody?
Bookmarks