diff --git a/src/Manipulators/Size.php b/src/Manipulators/Size.php index 8d55133..298f10a 100644 --- a/src/Manipulators/Size.php +++ b/src/Manipulators/Size.php @@ -352,7 +352,7 @@ public function runCropResize(ImageInterface $image, $width, $height): ImageInte $zoom = $this->getCrop()[2]; - $image->resize($resize_width * $zoom, $resize_height * $zoom); + $image->scale((int) ($resize_width * $zoom), (int) ($resize_height * $zoom)); list($offset_x, $offset_y) = $this->resolveCropOffset($image, $width, $height); diff --git a/tests/Manipulators/SizeTest.php b/tests/Manipulators/SizeTest.php index d460b7d..f8fbdee 100644 --- a/tests/Manipulators/SizeTest.php +++ b/tests/Manipulators/SizeTest.php @@ -148,10 +148,10 @@ public function testRunResize() $mock->shouldReceive('height')->andReturn(100)->times(4); $mock->shouldReceive('crop')->andReturn($mock)->once(); $mock->shouldReceive('contain')->andReturn($mock)->once(); - $mock->shouldReceive('resize')->with(100, 100)->andReturn($mock)->times(2); + $mock->shouldReceive('resize')->with(100, 100)->andReturn($mock)->once(); $mock->shouldReceive('pad')->andReturn($mock)->once(); $mock->shouldReceive('scaleDown')->with(100, 100)->andReturn($mock)->times(1); - $mock->shouldReceive('scale')->with(100, 100)->andReturn($mock)->times(1); + $mock->shouldReceive('scale')->with(100, 100)->andReturn($mock)->times(2); }); $this->assertInstanceOf( @@ -243,7 +243,7 @@ public function testRunCropResize() $image = \Mockery::mock(ImageInterface::class, function ($mock) { $mock->shouldReceive('width')->andReturn(100)->times(4); $mock->shouldReceive('height')->andReturn(100)->times(4); - $mock->shouldReceive('resize')->with(100, 100)->andReturn($mock)->once(); + $mock->shouldReceive('scale')->with(100, 100)->andReturn($mock)->once(); $mock->shouldReceive('crop')->with(100, 100, 0, 0)->andReturn($mock)->once(); }); @@ -288,7 +288,7 @@ public function testResizeDoesRunWhenDimensionsAreTheSameAndTheCropZoomIsNotDefa $image = \Mockery::mock(ImageInterface::class, function ($mock) { $mock->shouldReceive('width')->andReturn(100); $mock->shouldReceive('height')->andReturn(100); - $mock->shouldReceive('resize')->once(); + $mock->shouldReceive('scale')->once(); $mock->shouldReceive('crop')->once()->andReturn($mock); });