[eluser]zbrox[/eluser]
Hi there,
I'm trying to resize an image to a smaller one with different proportions. The resulting image comes out with an area of black where's the extra space. However I need it to be either transparent, or white, but not black
I edited the Image library so that it would resize PNG's without losing the transparency. I added this:
Code:
if ($this->image_type == 3 || $this->image_type == 1) {
//Using alpha channel
imagealphablending($dst_img, false);
imagesavealpha($dst_img,true);
//Allocating transparent color
$transparent = imagecolorallocatealpha($dst_img, 255, 255, 255, 127);
//full image filled with transparent color
imagefilledrectangle($dst_img, 0, 0, $this->width, $this->height, $transparent);
}
Judging by it imagefilledrectangle gets $transparent as a background color, I tried changing it to the $white variable used above in the code, but still the result is a black background.
Any ideas why this is happening?