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, ]; }