Image thumbnail maker?

Associate
Joined
21 Oct 2002
Posts
306
Location
Devon
I am currently in the process of writing a php based site for a band. The gallery page allows admins(band members) to upload a picture via the inbuilt file upload form and then to be organised and comments added. But is there any way to dynamically produce a thumbnail image for a picture when it is uploaded. I would prefere a php based method (if possible) but any suggestions are welcome.
 
Perhaps something like this?

Code:
//Resize thumbnail image
		$dest_x = '200';
		$dest_y = '125';
		/* Create a new image object (not neccessarily true colour) */
		$target_id=imagecreatetruecolor($thumbimage_dest_x, $thumbimage_dest_y);
		/* Resize the original picture and copy it into the just created image object. */
		$target_pic=imagecopyresampled($target_id,$source_id,
                                   0,0,0,0,
                                   $thumbimage_dest_x,$thumbimage_dest_y,
                                   $source_x,$source_y);
		/* Create a jpeg with the quality of "99". */
		imagejpeg ($target_id,'../galleries/'.$gallery.'/thumb'.$filename.'.jpg','40');

That's taken from an existing script i've wrote, and you should be able to suss most of it out by looking at www.php.net/image
 
Back
Top Bottom