mirror of
https://github.com/Intervention/image.git
synced 2025-08-30 09:10:21 +02:00
CropResizeModifier
This commit is contained in:
@@ -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(),
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user