Skip to content

Commit

Permalink
Change behaviour of the position argument of ResizeCanvasModifier
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Dec 6, 2023
1 parent 87b90af commit b41c4d4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Modifiers/ResizeCanvasModifier.php
Expand Up @@ -22,6 +22,16 @@ public function cropSize(ImageInterface $image): SizeInterface
$height = is_null($this->height) ? $image->height() : $this->height;

return (new Rectangle($width, $height))
->alignPivotTo($image->size(), $this->position);
->alignPivotTo($image->size(), $this->position());
}

protected function position(): string
{
return strtr($this->position, [
'left' => 'right',
'right' => 'left',
'top' => 'bottom',
'bottom' => 'top',
]);
}
}

0 comments on commit b41c4d4

Please sign in to comment.