$image = "product_images/" . $array['img'];
$size = getimagesize($image);
$max = 90;
if($size[0] > $size[1]) {
$largest = "width";
} else {
$largest = "height";
}
if($largest == "width") {
if($size[0] > $max) {
$difference = $size[0] - $max;
$percent = $difference / $size[0];
$height = round($size[1] - ($size[1] * $percent));
$width = $max;
} else {
$width = $size[0];
$height = $size[1];
}
} else if($largest == "height") {
if($size[1] > $max) {
$difference = $size[1] - $max;
$percent = $difference / $size[1];
$width = round($size[0] - ($size[0] * $percent));
$height = $max;
} else {
$width = $size[0];
$height = $size[1];
}
}
echo "Width: " . $width . " Height: " . $height . "
\n";