I am using a script that lets users upload images. The script resizes and converts the images to JPEG.
The problem I have is when a PNG with transparency is uploaded
Try like this (not tested):
case "png":
$file = imagecreatetruecolor($width, $height);
$new = imagecreatefrompng($this->file_tempname);
imagefilledrectangle ($file, 0, 0, $width, $height, imagecolorallocate($file, 0,0,0))
(predraw a white background on $file image)
Also, the for($i=0; $i<256; $i++) { imagecolorallocate($file, $i, $i, $i); }
part looks strange.