I see at least one post per month on how to resize images on the fly, and I don't blame them; there are hardly any decent tutorials on how to quickly do this especially if you are running PHP on Windows.
So here it is. A quick and dirty way to resize and replace your jpegs. Just make sure you un-comment extension=php_gd.dll in your php.ini file and also make sure the path to your extensions is where php_gd.dll resides.
Ok here we go. This is a simple function. Just copy it in your file and then call the function whenever you need to resize an image (most probably on your file upload page).
// resize function
function resize_jpg($img,$w,$h){
$thumb = imagecreate ($w, $h);
$image = ImageCreateFromJpeg($img);
$imagedata = getimagesize($img);
imagecopyresized ($thumb, $image, 0, 0, 0, 0, $w, $h, $imagedata[0], $imagedata[1]);
imagejpeg($thumb, $img);
}
// end function
// call resize function
resize_jpg("somepic.jpg",100,100);
That's it! The file somepic.jpg is now 100x100.
Good Luck
A