From 345e315272710e8e0988fc562711e7624a2bbdbf Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 19 Jul 2022 15:20:29 -0400 Subject: [PATCH] Be a bit more explicit about the saveImage aspect ratio preservation (even though in theory intervention/image handles that) --- app/Models/DashboardModel.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Models/DashboardModel.php b/app/Models/DashboardModel.php index 82b37e3..12fc0e8 100644 --- a/app/Models/DashboardModel.php +++ b/app/Models/DashboardModel.php @@ -246,15 +246,18 @@ class DashboardModel extends Model $new_height = ($new_width / $width) * $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) { if ($width > $max_width) { $new_width = $max_width; + $new_height = ($new_width / $width) * $height; } } else if ($height > $max_height) { $new_height = $max_height; + $new_width = ($new_height / $height) * $width; } if (!is_null($new_width) || !is_null($new_height)) {