Hi,
I'm making thumbnails. I want to first scale down the image before I crop it to a static size (so all the thumbs will be the same size). The code below only creates a solid black square.
Actually, only $final_im creates an image that's solid black. If I used $im as the output file (if I use this instead: imagejpeg($im, "$new_name") ), it's fine (albeit a very low quality image that does not have the dimensions I desire).
I figure the problem lies at the //create final thumbnail section of the code. But, again, everything looks right.
I would try other functions like imagecopyresizedbicubic , or imagecopyresampled but my server is using an older GD version, and I cannot upgrade it (ISP's server).
$src = imagecreatefromjpeg("$uploadimg/$found");
$im = imagecreate($newwidth,$newheight);
imagecopyresized($im,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
//create final thumbnail
$final_im = imagecreate($thwidth,$thheight);
imagecopyresized($final_im,$im,0,0,$scw,$sch,$thwidth,$thheight,$thwidth,$thheight);
// made the resize now lets put the new image where it needs to go.....
imagejpeg($final_im, "$new_name") or die ("The Thumb could not be created");
imagedestroy($src);
imagedestroy($im);
imagedestroy($final_im);
THANKS!
CHAP