It still doesn't work quite like it should
I want it to do this.
Check if height is more than width,
If height is more than width, then max height is ex 400
if width is more than height, then max width is ex 400
the script is now:
/*********************************************************************
Resizing images
*********************************************************************/
function resizeimage($input_file, $output_file, $thumb_max_width, $thumb_max_height, $thumb_quality) {
// read image size
$size = getimagesize($input_file);
// read the input file
$input_image = imagecreatefromjpeg($input_file);
// compute ratio
$ratio = min($thumb_max_width,$size[1],$thumb_max_height/$size[0]);
// create output image
$output_image = ImageCreatefromjpeg($input_file);
// resample image
// when using GD 1.x change this to imagecopyresized
$output_image = imagecreatetruecolor(round($size[0] * $ratio),round($size[1] * $ratio));
imagecopyresampled($output_image, $input_image, 0, 0, 0, 0, round($size[0]* $ratio), round($size[1] * $ratio), $size[0], $size[1]);
// create output image
imagejpeg($output_image,$output_file,$thumb_quality);
imagedestroy($input_image);
imagedestroy($output_image);
}
?>