JoeAtRevolutionUnltd
Programmer
I'm trying to resize a png with a transparent background. The file gets saved but when I try to view it, it says no preview available. This is the code i'm using.
Code:
$newImg = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($newImg, false);
imagesavealpha($newImg,true);
$transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127);
imagefilledrectangle($newImg, 0, 0, $newwidth, $newheight, $transparent);
imagecopyresampled($newImg, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$filename= $output_dir.$cur_file;
@imagepng($newImg, $filename, 95);