Skip to content

Commit

Permalink
Fix incorrect focal point
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam authored Feb 21, 2020
1 parent 22c64f6 commit dd54c38
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,14 @@ private function _getTransformedImage ($image, $transform)
list($x, $y) = explode(' ', $position);
}

$x = (int) ($image->getWidth() * (floatval($x) / 100));
$y = (int) ($image->getHeight() * (floatval($y) / 100));
$x = floatval($x);
$y = floatval($y);

if ($x > 1) $x /= 100;
if ($y > 1) $y /= 100;

$x = (int) ($image->getWidth() * $x);
$y = (int) ($image->getHeight() * $y);

if ($x < 1) $x++;
if ($y < 1) $y++;
Expand Down

0 comments on commit dd54c38

Please sign in to comment.