I had just written this yesterday, i really don't remember doing it but I did apparently only reason i know is cause of my goofy comments. This is actually part of a class i am writing but it should help you
function resizeImage($source,$dest,$x)
{
// get the sizes and type of the image
$size = $this->sizeofImage($source);
$type = $this->typeofImage($source);
// set the new height(y) of image
$y = (int) (($x / $size['x']) * $size['y']);
// create the image area
$imageDest = imagecreatetruecolor($x, $y);
// check the type of image so we know what to do next
if($type === "image/jpeg")
{
$imageOrg = imagecreatefromjpeg($source);
imagecopyresampled($imageDest, $imageOrg, 0, 0, 0, 0, $x, $y, $size['x'], $size['y']);
imagejpeg($imageDest,$dest,'100') or die("Could not make image");
} else if($type === "image/png") {
$imageOrg = imagecreatefrompng($source);
imagecopyresampled($imageDest, $imageOrg, 0, 0, 0, 0, $x, $y, $size['x'], $size['y']);
imagepng($imageDest,$dest,'100') or die("Could not make image");
} else if($type === "image/gif") {
$imageOrg = imagecreatefromgif($source);
imagecopyresampled($imageDest, $imageOrg, 0, 0, 0, 0, $x, $y, $size['x'], $size['y']);
imagepng($imageDest,$dest,'100') or die("Could not make image");
}
// remove image from memory...
// god i wish i could just remove images from my memory.
// imagine how nice it would be not to have to have that mental
// picture of that guy getting his head stuck up that elephants arse
// or that mental image of your parents doing the nasty in the kitchen
// with your best friends cousin when you came home when practice was
// done early. God please give me an imagedestroy() for my brain!!!
// Amen.
imagedestroy($imageDest);
return TRUE;
}