Forum Moderators: coopster
$img_name = $filename; //from earlier in script
$max_width = "230";
$image_details = getimagesize("$img_name");
$imagesize_x = $image_details[0];
$imagesize_y = $image_details[1];
$thumb_width = $maxwidth;
$thumb_height = (int)(($max_width*$imagesize_y)/imagesize_x);
$source = imagecreatefromjpeg($img_name);
$dest = imagecreatetruecolor($thumb_width, $thumb_height);
$final = imagecopyresampled ($dest, $source, 0, 0, 0, 0, $thumb_width, $thumb_height, $imagesize_x, $imagesize_y);
imagejpeg($final, "savenew.jpg", 90);
imagedestroy($dest);
imagedestroy($source);
Like on my server, it would be:
/home/username/public_html/thumbnails/savenow.jpg
Here's a similar script I wrote a long time ago. It's a bit sloppy but may give you some insight.
[webmasterworld.com...] scroll dow a bit to get to it.