Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Dec 5, 2023
1 parent 9e35223 commit 809bd16
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/Drivers/Imagick/Modifiers/ContainModifier.php
Expand Up @@ -20,7 +20,6 @@ class ContainModifier extends DriverSpecializedModifier
{
public function apply(ImageInterface $image): ImageInterface
{

$crop = $this->getCropSize($image);
$resize = $this->getResizeSize($image);
$transparent = new ImagickPixel('transparent');
Expand Down Expand Up @@ -48,13 +47,14 @@ public function apply(ImageInterface $image): ImageInterface
// fill new emerged background
$draw = new ImagickDraw();
$draw->setFillColor($background);
$draw->rectangle(
0,
0,
$crop->pivot()->x() - 1,
$resize->height()
);
$frame->native()->drawImage($draw);
if ($crop->pivot()->x() > 0) {
$draw->rectangle(
0,
0,
$crop->pivot()->x(),
$resize->height()
);
}
$draw->rectangle(
$crop->pivot()->x() + $crop->width(),
0,
Expand All @@ -68,13 +68,14 @@ public function apply(ImageInterface $image): ImageInterface
// fill new emerged background
$draw = new ImagickDraw();
$draw->setFillColor($background);
$draw->rectangle(
0,
0,
$resize->width(),
$crop->pivot()->y() - 1
);
$frame->native()->drawImage($draw);
if ($crop->pivot()->y() > 0) {
$draw->rectangle(
0,
0,
$resize->width(),
$crop->pivot()->y(),
);
}
$draw->rectangle(
0,
$crop->pivot()->y() + $crop->height(),
Expand Down

0 comments on commit 809bd16

Please sign in to comment.