I also had to do this before. I no longer have the code but will tell you how I did it:
You must have the GD library installed. I will use the JPEG functions here; you will need to change them to whatever kind of image you are working with.
<?
//Set the new width and height
$newWidth = 100;
$newHeight = 100;
//Get the old image
$origImage = ImageJpeg("my_image.jpg");
$oldWidth = ImageSX($origImage);
$oldHeight = ImageSY($origImage);
//make the new one
$newImage = ImageCreate($newWidth, $newHeight);
ImageCopyResized( $newImage, $oldImage, 0, 0, 0, 0, $newWidth, $newHeight, $oldWidth, $oldHeight );
// Then save and/or output the image ie.
// Header("Content-type: image/jpeg");
// ImageJpeg($newImage, 100);
Good luck!
Jack