play with it, hope it helps you with it;
<?php
Function createthumbnail($src=null,$newHeight=null) {
$srcimg = imagecreatefromjpeg($src);
$srcsize = getimagesize($src);
$dest_y = $newHeight;
$dest_x = ($newHeight / $srcsize[1]) * $srcsize[0];
$thumbimg = imagecreatetruecolor($dest_x, $dest_y);
imagecopyresampled($thumbimg,$srcimg,0,0,0,0,$dest_x,$dest_y, $srcsize[0], $srcsize[1]);
$thumbimg = imagejpeg($thumbimg,$src);
return $thumbimg;
}
?>
you can call it like this
<?php
resizedImage = createthumbnail(urlOfFileToResize,newHeight);//newHeight would be like 1 or 50 or 1000......
?>
now your resized image will be saved in resizedImage
Welcome.