#native_company# #native_desc#

Thumbnail Function

By Lee Willmann
on October 7, 2006

Version: 1.01

Type: Function

Category: Graphics

License: GNU General Public License

Description: A simple function that takes a png image and creates a thumbnail in a subdirectory.

function make_thumb($imagefile, $new_w=150, $new_h=100) 
	// get source image info.

	// get source image
	$src_img=imagecreatefromjpeg($imagefile) or die ("Cannot open source"); 

	// create a target image

	// create the thumbnail
	imagecopyresized($dst_img,$src_img, 0, 0, 0, 0, $new_w, $new_h, $src_w, $src_h); 

	// switch to subdir.

	// if the image already exists blow it away.
	if ( file_exists($imagefile) ) 

	// I use thumb_ to show that it is a thumbnail. 
	// save the new image as a png.

	// free up the memory.