mirror of
https://github.com/Intervention/image.git
synced 2025-07-31 19:10:12 +02:00
Fix bug
This commit is contained in:
@@ -20,7 +20,6 @@ class ContainModifier extends DriverSpecializedModifier
|
|||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
$crop = $this->getCropSize($image);
|
$crop = $this->getCropSize($image);
|
||||||
$resize = $this->getResizeSize($image);
|
$resize = $this->getResizeSize($image);
|
||||||
$transparent = new ImagickPixel('transparent');
|
$transparent = new ImagickPixel('transparent');
|
||||||
@@ -48,13 +47,14 @@ class ContainModifier extends DriverSpecializedModifier
|
|||||||
// fill new emerged background
|
// fill new emerged background
|
||||||
$draw = new ImagickDraw();
|
$draw = new ImagickDraw();
|
||||||
$draw->setFillColor($background);
|
$draw->setFillColor($background);
|
||||||
$draw->rectangle(
|
if ($crop->pivot()->x() > 0) {
|
||||||
0,
|
$draw->rectangle(
|
||||||
0,
|
0,
|
||||||
$crop->pivot()->x() - 1,
|
0,
|
||||||
$resize->height()
|
$crop->pivot()->x(),
|
||||||
);
|
$resize->height()
|
||||||
$frame->native()->drawImage($draw);
|
);
|
||||||
|
}
|
||||||
$draw->rectangle(
|
$draw->rectangle(
|
||||||
$crop->pivot()->x() + $crop->width(),
|
$crop->pivot()->x() + $crop->width(),
|
||||||
0,
|
0,
|
||||||
@@ -68,13 +68,14 @@ class ContainModifier extends DriverSpecializedModifier
|
|||||||
// fill new emerged background
|
// fill new emerged background
|
||||||
$draw = new ImagickDraw();
|
$draw = new ImagickDraw();
|
||||||
$draw->setFillColor($background);
|
$draw->setFillColor($background);
|
||||||
$draw->rectangle(
|
if ($crop->pivot()->y() > 0) {
|
||||||
0,
|
$draw->rectangle(
|
||||||
0,
|
0,
|
||||||
$resize->width(),
|
0,
|
||||||
$crop->pivot()->y() - 1
|
$resize->width(),
|
||||||
);
|
$crop->pivot()->y(),
|
||||||
$frame->native()->drawImage($draw);
|
);
|
||||||
|
}
|
||||||
$draw->rectangle(
|
$draw->rectangle(
|
||||||
0,
|
0,
|
||||||
$crop->pivot()->y() + $crop->height(),
|
$crop->pivot()->y() + $crop->height(),
|
||||||
|
Reference in New Issue
Block a user