This following bit of code will create a thumbnail of size $thumb_width x $thumb_height based off of the initial file $file_location. Current GD libraries don't work on GIFs, so that's not an option. You can use the relative PNG functions in place of the jpeg functions, however. // Create New Image $full_img = imagecreatefromjpeg("$file_location"); $thumb_img = imagecreatetruecolor($thumb_width,$thumb_height); imagecopyresized($thumb_img,$full_img,0,0,0,0,$thumb_width,$thumb_height,$wi dth,$height); imagedestroy($full_img); imagejpeg($thumb_img,"$path_to_save\\$thumb_name"); imagedestroy($thumb_img); print "<img src='$path_to_save\\$thumb_name'>"; // Might Need To Change Paths Pending How Script Is Called The best thing to do, however, is to spend time reading all of the image functions in the manual http://us2.php.net/manual/en/ref.image.php . There's a lot in there and you can do some very impressive things with images if you spend some time reading. -M -----Original Message----- From: Tony Devlin [mailto:tdevlin@xxxxxxxxxxxxx] Sent: Friday, November 19, 2004 9:41 AM To: Php-Windows Subject: GD Image Resizing on the fly. Hello Everyone, I am looking for a script or guidance in where to look to figure out how to create a php script that resizes an image on the fly when it is called with some variables. To further detail, I have a shopping cart I am creating for a client -- the client has the ability to upload images, instead of creating a very complex script when he uploads the file, I figured on the shopping cart page I could grab the original file and then resize it to display a thumbnail based on 2 variables being sent W,H (Width, Height). The products are stored in a database along with the image path. I need it to display in the middle of a page so a "header( 'Content-type: image/jpeg' );" won't work for obvious reasons (header already sent). Also it will have to distinquish between Gif and Jpeg (not a problem, just preg-match the extension). I know the exact sizes that we want the shopping cart images to be. Anyone have any ideas? If you need more information just ask. Thanks everyone -- this is such a great community! Tony Devlin -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php