Forum Moderators: coopster
<?php
Header("Content-type: image/jpeg");
$filenamee = "$DOCUMENT_ROOT/images/list/$filename";
$orig_image = imagecreatefrompng($filenamee);
list($width, $height, $type, $attr) = getimagesize($filenamee);
if ($width > $size) {
$ratio = $size / $width;
$newwidth = $size;
$newheight = $ratio * $height; }
if ($width <= $size) {
$newwidth = $width;
$newheight = $height; }
$sm_image = imagecreatetruecolor($newwidth,$newheight) or die ("Cannot Initialize new GD image stream");;
Imagecopyresampled($sm_image,$orig_image,0,0,0,0,$newwidth,$newheight,imagesx($orig_image),imagesy($orig_image));
imageJPEG($sm_image);
imagedestroy($sm_image);
imageDestroy($orig_image);
?>
Your question *might* have an easy answer:
you tried an imagefilledrectangle(<correct params go here>) on your $sm_image after having done an imagecolorallocate() for this image, creating a grey or white color? If not, of course it'll have a black background, since images when first created are black.
If this doesn't work, look over the various switch functions very carefully in gd, such as imagealphablending() and imagesavealpha().