Skip to content

Commit 488d33b

Browse files
authored
Merge pull request #429 from thephpleague/resize-background
Fix background color not being applied.
2 parents eea3381 + 09e387d commit 488d33b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Manipulators/Size.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function runMaxResize(ImageInterface $image, int $width, int $height): Im
299299
*/
300300
public function runFillResize(ImageInterface $image, int $width, int $height): ImageInterface
301301
{
302-
return $image->pad($width, $height);
302+
return $image->pad($width, $height, 'transparent');
303303
}
304304

305305
/**
@@ -313,7 +313,7 @@ public function runFillResize(ImageInterface $image, int $width, int $height): I
313313
*/
314314
public function runFillMaxResize(ImageInterface $image, int $width, int $height): ImageInterface
315315
{
316-
return $image->contain($width, $height);
316+
return $image->contain($width, $height, 'transparent');
317317
}
318318

319319
/**
@@ -349,7 +349,7 @@ public function runCropResize(ImageInterface $image, int $width, int $height): I
349349

350350
[$offset_x, $offset_y] = $this->resolveCropOffset($image, $width, $height);
351351

352-
return $image->crop($width, $height, $offset_x, $offset_y);
352+
return $image->crop($width, $height, $offset_x, $offset_y, 'transparent');
353353
}
354354

355355
/**

tests/Manipulators/SizeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function testRunContainResize(): void
219219
public function testRunFillResize(): void
220220
{
221221
$image = \Mockery::mock(ImageInterface::class, function ($mock) {
222-
$mock->shouldReceive('pad')->with(100, 100)->andReturn($mock)->once();
222+
$mock->shouldReceive('pad')->with(100, 100, 'transparent')->andReturn($mock)->once();
223223
});
224224

225225
$this->assertInstanceOf(
@@ -258,7 +258,7 @@ public function testRunCropResize(): void
258258
$mock->shouldReceive('width')->andReturn(100)->times(4);
259259
$mock->shouldReceive('height')->andReturn(100)->times(4);
260260
$mock->shouldReceive('scale')->with(100, 100)->andReturn($mock)->once();
261-
$mock->shouldReceive('crop')->with(100, 100, 0, 0)->andReturn($mock)->once();
261+
$mock->shouldReceive('crop')->with(100, 100, 0, 0, 'transparent')->andReturn($mock)->once();
262262
});
263263

264264
$this->assertInstanceOf(

0 commit comments

Comments
 (0)