Hi,
To give you a start..
$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
{
$result = move_uploaded_file($tmp_picture, $new_picture);
}
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);
}
With the GD library you can then create new images