From e93ed68b0702c8366192e7b134b8b47ee84d73f1 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Tue, 9 Jan 2024 09:46:16 +0100 Subject: [PATCH] Fix bugs in CropModifiers --- src/Drivers/Gd/Modifiers/CropModifier.php | 4 ++-- src/Drivers/Imagick/Modifiers/CropModifier.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Drivers/Gd/Modifiers/CropModifier.php b/src/Drivers/Gd/Modifiers/CropModifier.php index 7cac004c..98140680 100644 --- a/src/Drivers/Gd/Modifiers/CropModifier.php +++ b/src/Drivers/Gd/Modifiers/CropModifier.php @@ -92,7 +92,7 @@ class CropModifier extends SpecializedModifier } // cover the possible newly created areas with background color - if ($this->offset_x < 0 || $resizeTo->pivot()->x() != 0) { + if ((($this->offset_x * -1) - $resizeTo->pivot()->x() - 1) > 0) { imagefilledrectangle( $modified, 0, @@ -104,7 +104,7 @@ class CropModifier extends SpecializedModifier } // cover the possible newly created areas with background color - if ($this->offset_y < 0 || $resizeTo->pivot()->y() != 0) { + if ((($this->offset_y * -1) - $resizeTo->pivot()->y() - 1) > 0) { imagefilledrectangle( $modified, ($this->offset_x * -1) - $resizeTo->pivot()->x(), diff --git a/src/Drivers/Imagick/Modifiers/CropModifier.php b/src/Drivers/Imagick/Modifiers/CropModifier.php index c351b4bb..f33705b7 100644 --- a/src/Drivers/Imagick/Modifiers/CropModifier.php +++ b/src/Drivers/Imagick/Modifiers/CropModifier.php @@ -64,7 +64,7 @@ class CropModifier extends DriverSpecializedModifier } // cover the possible newly created areas with background color - if ($this->offset_x < 0 || $crop->pivot()->x() != 0) { + if ((($this->offset_x * -1) - $crop->pivot()->x() - 1) > 0) { $draw->rectangle( 0, 0, @@ -74,7 +74,7 @@ class CropModifier extends DriverSpecializedModifier } // cover the possible newly created areas with background color - if ($this->offset_y < 0 || $crop->pivot()->y() != 0) { + if ((($this->offset_y * -1) - $crop->pivot()->y() - 1) > 0) { $draw->rectangle( ($this->offset_x * -1) - $crop->pivot()->x(), 0,