1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 09:10:21 +02:00

CropResizeModifier

This commit is contained in:
Oliver Vogel
2021-11-11 15:15:38 +00:00
parent 989166aced
commit 385e58ca7d
3 changed files with 7 additions and 7 deletions

View File

@@ -26,7 +26,7 @@ class CropResizeModifier implements ModifierInterface
foreach ($image as $frame) {
if ($shouldCrop) {
$frame->getCore()->cropImage(
$frame->getCore()->extentImage(
$this->crop->getWidth(),
$this->crop->getHeight(),
$this->crop->getPivot()->getX(),

View File

@@ -3,12 +3,12 @@
namespace Intervention\Image\Tests\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\Gd\Image;
use Intervention\Image\Drivers\Gd\Modifiers\ResizeModifier;
use Intervention\Image\Drivers\Gd\Modifiers\CropResizeModifier;
use Intervention\Image\Geometry\Size;
use Intervention\Image\Tests\TestCase;
use Intervention\Image\Tests\Traits\CanCreateGdTestImage;
class ResizeModifierTest extends TestCase
class CropResizeModifierTest extends TestCase
{
use CanCreateGdTestImage;
@@ -17,7 +17,7 @@ class ResizeModifierTest extends TestCase
$image = $this->createTestImage('trim.png');
$this->assertEquals(50, $image->width());
$this->assertEquals(50, $image->height());
$image->modify(new ResizeModifier(new Size(30, 20)));
$image->modify(new CropResizeModifier(new Size(50, 50), new Size(30, 20)));
$this->assertEquals(30, $image->width());
$this->assertEquals(20, $image->height());
}

View File

@@ -3,12 +3,12 @@
namespace Intervention\Image\Tests\Drivers\Imagick\Modifiers;
use Intervention\Image\Drivers\Imagick\Image;
use Intervention\Image\Drivers\Imagick\Modifiers\ResizeModifier;
use Intervention\Image\Drivers\Imagick\Modifiers\CropResizeModifier;
use Intervention\Image\Geometry\Size;
use Intervention\Image\Tests\TestCase;
use Intervention\Image\Tests\Traits\CanCreateImagickTestImage;
class ResizeModifierTest extends TestCase
class CropResizeModifierTest extends TestCase
{
use CanCreateImagickTestImage;
@@ -17,7 +17,7 @@ class ResizeModifierTest extends TestCase
$image = $this->createTestImage('trim.png');
$this->assertEquals(50, $image->width());
$this->assertEquals(50, $image->height());
$image->modify(new ResizeModifier(new Size(30, 20)));
$image->modify(new CropResizeModifier(new Size(50, 50), new Size(30, 20)));
$this->assertEquals(30, $image->width());
$this->assertEquals(20, $image->height());
}