1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-01 09:52:59 +02:00

Change behaviour of the position argument of ResizeCanvasModifier

This commit is contained in:
Oliver Vogel
2023-12-06 17:21:12 +01:00
parent 87b90afcb2
commit b41c4d4af0

View File

@@ -22,6 +22,16 @@ class ResizeCanvasModifier extends AbstractModifier
$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',
]);
}
}