Skip to content

Commit

Permalink
Merge pull request #2150 from MGatner/image-fit
Browse files Browse the repository at this point in the history
New logic for Image->fit()
  • Loading branch information
lonnieezell authored Aug 20, 2019
2 parents 884fd96 + 20df65e commit b889831
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
];
}

Expand Down

0 comments on commit b889831

Please sign in to comment.