1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-11 16:34:00 +02:00

Merge pull request #335 from Sm0ke0ut/master

lowered the resource usage of GetSizeCommand() which fixes some odd Imag...
This commit is contained in:
Oliver Vogel
2015-03-09 14:03:15 +01:00
2 changed files with 7 additions and 5 deletions

View File

@@ -14,11 +14,12 @@ class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand
*/ */
public function execute($image) public function execute($image)
{ {
$info = $image->getCore()->identifyImage(); /** @var \Imagick $core */
$core = $image->getCore();
$this->setOutput(new Size( $this->setOutput(new Size(
$info['geometry']['width'], $core->getImageWidth(),
$info['geometry']['height'] $core->getImageHeight()
)); ));
return true; return true;

View File

@@ -9,7 +9,7 @@ class GetSizeCommandTest extends PHPUnit_Framework_TestCase
{ {
Mockery::close(); Mockery::close();
} }
public function testGd() public function testGd()
{ {
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg'); $resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
@@ -25,7 +25,8 @@ class GetSizeCommandTest extends PHPUnit_Framework_TestCase
public function testImagick() public function testImagick()
{ {
$imagick = Mockery::mock('Imagick'); $imagick = Mockery::mock('Imagick');
$imagick->shouldReceive('identifyimage')->with(); $imagick->shouldReceive('getimagewidth')->with();
$imagick->shouldReceive('getimageheight')->with();
$image = Mockery::mock('Intervention\Image\Image'); $image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($imagick); $image->shouldReceive('getCore')->once()->andReturn($imagick);
$command = new GetSizeImagick(array()); $command = new GetSizeImagick(array());