Hi there,
You might like to try using something like this instead, it should do the trick if you're using PHP 5:
$originalImage = $_FILES['image']['tmp_name'];
$src = imagecreatefromjpeg($originalImage);
list($width,$height) = getimagesize($originalImage);
$ratio = $width/$height;
if ($width > $height)
{if ($width > 300)
{$new_height = 300 / $ratio;
$new_width = 300;}
else
{$new_height = $height;
$new_width = $width;}}
else
{if ($height > 300)
{$new_width = 300 * $ratio;
$new_height = 300;}
else
{$new_height = $height;
$new_width = $width;}}
$target = "upload/image.jpg";
$tmp = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($tmp,$src,0,0,0,0,$new_width,$new_height,$width,$height);
imagejpeg($tmp,$target,100);
This will resize your image to a maximum of 300px while retaining the original dimensions.
If you're still having problems the manual for GD library is very helpful and not too hard to understand.
Hope it works out ok!
Kirsty