From 1e7b284f5eed963f1c6e9810d62ee3d3409cb624 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Wed, 22 Apr 2015 17:43:41 +0200 Subject: [PATCH 1/2] changed Imagick method of resizeCommand --- src/Intervention/Image/Imagick/Commands/ResizeCommand.php | 2 +- tests/HeightenCommandTest.php | 2 +- tests/ResizeCommandTest.php | 2 +- tests/WidenCommandTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Intervention/Image/Imagick/Commands/ResizeCommand.php b/src/Intervention/Image/Imagick/Commands/ResizeCommand.php index 6051dd1b..9ccc202c 100644 --- a/src/Intervention/Image/Imagick/Commands/ResizeCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ResizeCommand.php @@ -20,7 +20,7 @@ class ResizeCommand extends \Intervention\Image\Commands\AbstractCommand $resized = $image->getSize()->resize($width, $height, $constraints); // modify image - $image->getCore()->resizeImage($resized->getWidth(), $resized->getHeight(), \Imagick::FILTER_BOX, 1); + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); return true; } diff --git a/tests/HeightenCommandTest.php b/tests/HeightenCommandTest.php index ff13ae90..7290f427 100644 --- a/tests/HeightenCommandTest.php +++ b/tests/HeightenCommandTest.php @@ -33,7 +33,7 @@ class HeightenCommandTest extends PHPUnit_Framework_TestCase { $callback = function ($constraint) { $constraint->upsize(); }; $imagick = Mockery::mock('Imagick'); - $imagick->shouldReceive('resizeimage')->with(300, 200, \Imagick::FILTER_BOX, 1)->once()->andReturn(true); + $imagick->shouldReceive('scaleimage')->with(300, 200)->once()->andReturn(true); $size = Mockery::mock('Intervention\Image\Size', array(800, 600)); $size->shouldReceive('resize')->once()->andReturn($size); $size->shouldReceive('getWidth')->once()->andReturn(300); diff --git a/tests/ResizeCommandTest.php b/tests/ResizeCommandTest.php index 56cdcb39..e315506b 100644 --- a/tests/ResizeCommandTest.php +++ b/tests/ResizeCommandTest.php @@ -33,7 +33,7 @@ class resizeCommandTest extends PHPUnit_Framework_TestCase { $callback = function ($constraint) { $constraint->upsize(); }; $imagick = Mockery::mock('Imagick'); - $imagick->shouldReceive('resizeimage')->with(300, 200, \Imagick::FILTER_BOX, 1)->once()->andReturn(true); + $imagick->shouldReceive('scaleimage')->with(300, 200)->once()->andReturn(true); $size = Mockery::mock('Intervention\Image\Size', array(800, 600)); $size->shouldReceive('resize')->with(300, 200, $callback)->once()->andReturn($size); $size->shouldReceive('getWidth')->once()->andReturn(300); diff --git a/tests/WidenCommandTest.php b/tests/WidenCommandTest.php index ce5b3042..a5444dfb 100644 --- a/tests/WidenCommandTest.php +++ b/tests/WidenCommandTest.php @@ -33,7 +33,7 @@ class WidenCommandTest extends PHPUnit_Framework_TestCase { $callback = function ($constraint) { $constraint->upsize(); }; $imagick = Mockery::mock('Imagick'); - $imagick->shouldReceive('resizeimage')->with(300, 200, \Imagick::FILTER_BOX, 1)->once()->andReturn(true); + $imagick->shouldReceive('scaleimage')->with(300, 200)->once()->andReturn(true); $size = Mockery::mock('Intervention\Image\Size', array(800, 600)); $size->shouldReceive('resize')->once()->andReturn($size); $size->shouldReceive('getWidth')->once()->andReturn(300); From c10021588b7c7ff8708fae071e82b0cb717c1e74 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Wed, 22 Apr 2015 17:55:49 +0200 Subject: [PATCH 2/2] bugfix --- .../Image/Gd/Commands/BackupCommand.php | 4 ++++ tests/tmp/crc.png | Bin 170 -> 0 bytes 2 files changed, 4 insertions(+) delete mode 100644 tests/tmp/crc.png diff --git a/src/Intervention/Image/Gd/Commands/BackupCommand.php b/src/Intervention/Image/Gd/Commands/BackupCommand.php index 8d21ee39..347daea6 100644 --- a/src/Intervention/Image/Gd/Commands/BackupCommand.php +++ b/src/Intervention/Image/Gd/Commands/BackupCommand.php @@ -19,6 +19,10 @@ class BackupCommand extends \Intervention\Image\Commands\AbstractCommand $clone = imagecreatetruecolor($size->width, $size->height); imagealphablending($clone, false); imagesavealpha($clone, true); + $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127); + imagefill($clone, 0, 0, $transparency); + + // copy image to clone imagecopy($clone, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height); $image->setBackup($clone, $backupName); diff --git a/tests/tmp/crc.png b/tests/tmp/crc.png deleted file mode 100644 index 919886063c17607467695fc90c1fd3c3ea2a314a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`g`O^sAr`%BgQJBGIIv9idtd+b zi}&%xH_olw@7lCM!Sm*ZZ1z1a3|~H0v!>iHeBiR+4nVE``>D01~jhz zu~XM4%l-17=?~spX8!x>-1KGbksZnxwrL4{yr5-h