Cheers nogdog that works great everythings back to its aspect ratio.
Now my problem is that it is only meeting on the maximum requirements eg:
image goes in height greater than width:
if ($height > $width and $height > $maxheight)
{
$newheight = $maxheight;
$newwidth = $width * $maxheight / $height;
}
the image is resized to match the maxheight requirement but the maxwidth requirement is not met.
if ($width > $height and $width >= $maxwidth)
{
$newwidth = $maxwidth;
$newheight = $height * $maxwidth / $width;
}
else if ($height > $width and $height > $maxheight)
{
$newheight = $maxheight;
$newwidth = $width * $maxheight / $height;
}
else
{
$newwidth = $width;
$newheight = $height;
}