I just did a google search and found some very usefully code examples. Also, here's how I got it to work, it's built to handle a gif that was uploaded via a form:
$ThumbPath = "/www/Thumbs/"; //Location of where you want to store the image
// 'File' is the name of the file form element that was posted to this script
if (is_uploaded_file ($HTTP_POST_FILES['File']['tmp_name']))
{
// $PhotoSizeType becomes an array of info about the photo. Lookup getimagesize for more info
$PhotoSizeType = getimagesize($HTTP_POST_FILES['File'.$i]['tmp_name']); // PhotoSizeType is an array, 0 = width, 1 = height, 2 = image type
if ($PhotoSizeType[2] == 1) //Will only work with the photo if it is GIF
{
// All thumbnails will be 150 pixels tall w/ it's equivelant ratio in width
$ThumbHeight = 150;
$ThumbWidth = $PhotoSizeType[0] / ($PhotoSizeType[1] / $ThumbHeight);
$TmpPhoto = ImageCreateFromGIF ($HTTP_POST_FILES['File'.$i]['tmp_name']);
$Thumb = ImageCreateTrueColor ($ThumbWidth, $ThumbHeight);
ImageCopyResampled ($Thumb, $TmpPhoto, 0, 0, 0, 0, $ThumbWidth, $ThumbHeight, imagesx ($TmpPhoto), imagesy ($TmpPhoto));
ImageJPEG ($Thumb, $ThumbPath."Some filename..jpg", 75); //75 is the quility of the output
}
}
Originally posted by slimkrazy
Ok, I have just found out that the GD library has been set up.
Anyone got any pointers to a good site that'll teach me how to do this conversion now??