Hey,
Try this code:
<?php
// set paths for main image and thumbnail
$main_img_path = "d:/path/to/image/";
$thumb_img_path = "d:/path/to/image/thumb/";
//get name of image from post env_var
$image_name = $HTTP_POST_FILES[imgname][name];
// create full paths for new images
$new_image = $main_img_path . $image_name;
$new_thumb = $thumb_image_path . $image_name;
// copy temp copy of uploaded image to final dir
@copy($imgname, $new_image);
// create image identifier from uploaded temp copy
$src_img = imagecreatefromjpeg($imgname);
// reduce image height and width by a sixth
$new_w = imagesx($src_img)/6;
$new_h = imagesy($src_img)/6;
// create new thumbnail identifer
$dst_img = imagecreate($new_w,$new_h);
// copy new thumbnail reference to final dir imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
// create thumbnail
imagejpeg($dst_img, $new_thumb);
echo "<a href = '/path/to/image/$image_name'><img src=/path/to/image/thumb/$image_name border = 0></a><br>";
?>
The above code is designed to accept an image ($imgname) from a file upload form and create a thumbnail for the uploaded image. It works well on Apache running PHP 4.0.3pl1 or higher as a module. Using PHP 4.0.3pl1 on IIS 4.0 gave warning messages that I couldn't seem to suppress. Works fine on PHP 4.0.4pl1 (didn't test it on 4.0.4). On IIS I've running PHP as an ISAPI module. Hope this helps!!!!
Cheers,
Geoff A. Virgo