From 20df65ec9edfa74323f3150b08337bdd45ce0b7b Mon Sep 17 00:00:00 2001 From: MGatner Date: Mon, 19 Aug 2019 20:26:53 -0400 Subject: [PATCH] Fix fit() --- system/Images/Handlers/BaseHandler.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/Images/Handlers/BaseHandler.php b/system/Images/Handlers/BaseHandler.php index 5971d836e587..cc5c13685eee 100644 --- a/system/Images/Handlers/BaseHandler.php +++ b/system/Images/Handlers/BaseHandler.php @@ -572,7 +572,7 @@ public function fit(int $width, int $height = null, string $position = 'center') $height = ceil(($width / $cropWidth) * $cropHeight); } - list($x, $y) = $this->calcCropCoords($width, $height, $origWidth, $origHeight, $position); + list($x, $y) = $this->calcCropCoords($cropWidth, $cropHeight, $origWidth, $origHeight, $position); return $this->crop($cropWidth, $cropHeight, $x, $y) ->resize($width, $height); @@ -610,14 +610,14 @@ protected function calcAspectRatio($width, $height = null, $origWidth, $origHeig if ($xRatio > $yRatio) { return [ - (int) ($origWidth * $yRatio), - (int) ($origHeight * $yRatio), + $origWidth, + (int) ($origWidth * $height / $width), ]; } return [ - (int) ($origWidth * $xRatio), - (int) ($origHeight * $xRatio), + (int) ($origHeight * $width / $height), + $origHeight, ]; }