1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-11 00:14:03 +02:00
This commit is contained in:
Oliver Vogel
2023-11-12 11:54:17 +01:00
parent 8b8bcb0d9c
commit b1eee25bfb

View File

@@ -16,7 +16,7 @@ class ResizeModifier implements ModifierInterface
public function apply(ImageInterface $image): ImageInterface public function apply(ImageInterface $image): ImageInterface
{ {
$resizeTo = $image->size()->resize($this->width, $this->height); $resizeTo = $this->getAdjustedSize($image);
foreach ($image as $frame) { foreach ($image as $frame) {
$this->resizeFrame($frame, $resizeTo); $this->resizeFrame($frame, $resizeTo);
@@ -25,6 +25,11 @@ class ResizeModifier implements ModifierInterface
return $image; return $image;
} }
protected function getAdjustedSize(ImageInterface $image): SizeInterface
{
return $image->size()->resize($this->width, $this->height);
}
protected function resizeFrame(FrameInterface $frame, SizeInterface $resizeTo): void protected function resizeFrame(FrameInterface $frame, SizeInterface $resizeTo): void
{ {
// create new image // create new image