And the question is...? Assuming you have trouble with getting it to check which is the max:
(Note: Copied from one of my script: Varnames may not match
// ***************** Get file details **************************
$size = GetImageSize($tmp_picture);
$aspectRat = (float)($size[1] / $size[0]);
// ***************** Calculate new x/y size, maintaining original aspect ratio
if( ($size[0] <= $new_max_width) && ($size[1] <= $new_max_width) ) // Image < max size
{
copy($tmp_picture, $new_picture);
$newX = $size[0];
$newY = $size[1];
}
else
{
$width_ratio = $size[0] / $new_max_width;
$height_ratio = $size[1] / $new_max_height;
if($width_ratio >= $height_ratio) // width needs to be reduced more
{
$newY = $new_max_width * $aspectRat;
$newX = $new_max_width;
}
else
{
$newY = $new_max_height;
$newX = $new_max_height * (1/$aspectRat);
}
//create the destination image resource.
$destImg = ImageCreateTrueColor($newX, $newY );
[edit]
In this script you can set bot the max hieght as the max width, which allows you to set different maximum values. You should just both tset them to the maximum dimensions you want.
[/edit]