Be a bit more explicit about the saveImage aspect ratio preservation (even though in theory intervention/image handles that)

This commit is contained in:
Kevin MacMartin 2022-07-19 15:20:29 -04:00
parent dcf86efa0f
commit 345e315272

View file

@ -246,15 +246,18 @@ class DashboardModel extends Model
$new_height = ($new_width / $width) * $height; $new_height = ($new_width / $width) * $height;
if ($new_height > $max_height) { if ($new_height > $max_height) {
$new_width = ($max_height / $height) * $width; $new_height = $max_height;
$new_width = ($new_height / $height) * $width;
} }
} }
} else if ($max_width > 0) { } else if ($max_width > 0) {
if ($width > $max_width) { if ($width > $max_width) {
$new_width = $max_width; $new_width = $max_width;
$new_height = ($new_width / $width) * $height;
} }
} else if ($height > $max_height) { } else if ($height > $max_height) {
$new_height = $max_height; $new_height = $max_height;
$new_width = ($new_height / $height) * $width;
} }
if (!is_null($new_width) || !is_null($new_height)) { if (!is_null($new_width) || !is_null($new_height)) {