Avatar

Patch: Avatar PNG Transparency (Bugs)

by Auge ⌂, Friday, June 20, 2014, 10:50 (3569 days ago) @ beornlake

We have several users who want to use PNG avatars with transparency. ...

if(empty($error)) {
imagesavealpha($new_image, true);
$transparency_fill = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
imagefill($new_image, 0, 0, $transparency_fill);
}

This fills the image with transparency before pixels are copied to the new canvas. This implementation appears to be working properly on our installation, but further testing is always prudent. ;-)

I'm new to the image creation process. That said, let's analyse the code (a bit). The description for the function imagesavealpha says "You have to unset alphablending, to use it.". Maybe it's a good idea to do that explicitely to ensure the use of the original image data.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread