diff --git a/src/Intervention/Image/Imagick/Commands/TrimCommand.php b/src/Intervention/Image/Imagick/Commands/TrimCommand.php index 3cf4e08b..46bac143 100644 --- a/src/Intervention/Image/Imagick/Commands/TrimCommand.php +++ b/src/Intervention/Image/Imagick/Commands/TrimCommand.php @@ -111,6 +111,7 @@ class TrimCommand extends \Intervention\Image\Commands\AbstractCommand // finally crop based on page $image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y); + $image->getCore()->setImagePage(0,0,0,0); $trimed->destroy(); diff --git a/tests/TrimCommandTest.php b/tests/TrimCommandTest.php index 53c9df44..de6d65ee 100644 --- a/tests/TrimCommandTest.php +++ b/tests/TrimCommandTest.php @@ -39,12 +39,13 @@ class TrimCommandTest extends PHPUnit_Framework_TestCase $imagick->shouldReceive('trimimage')->with(29632.5)->once()->andReturn(true); $imagick->shouldReceive('getimagepage')->once()->andReturn(array('x' => 50, 'y' => 50)); $imagick->shouldReceive('cropimage')->with(104, 202, 47, 0)->once()->andReturn(true); + $imagick->shouldReceive('setimagepage')->with(0, 0, 0, 0)->once()->andReturn(true); $imagick->shouldReceive('destroy')->with()->once()->andReturn(true); $image = Mockery::mock('Intervention\Image\Image'); $image->shouldReceive('getWidth')->once()->andReturn(800); $image->shouldReceive('getHeight')->once()->andReturn(600); $image->shouldReceive('pickColor')->with(0, 0, 'object')->once()->andReturn($baseColor); - $image->shouldReceive('getCore')->times(2)->andReturn($imagick); + $image->shouldReceive('getCore')->times(3)->andReturn($imagick); $command = new TrimImagick(array('top-left', array('left', 'right'), 45, 2)); $result = $command->execute($image); $this->assertTrue($result);