Black background in my thumbnails?!?!
When I generates thumnails like this:
PHP Code:
$save = $targetPath."thumb_" . $imagepath; //This is the new file you saving
$file = $targetPath."".$imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
if($width > $height){
$modwidth = 90;
$diff = $width / $modwidth;
$modheight = $height / $diff;
} else {
$modheight = 90;
$diff = $height / $modheight;
$modwidth = $width / $diff;
}
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100);
... it comes out with a black background... Is it possible to make this background white or even better, transparent?
Thanks...