mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 20:28:21 +01:00
bugfix
This commit is contained in:
parent
2cd95af911
commit
6c0574ddba
@ -504,8 +504,10 @@ class Image
|
||||
|
||||
// create new canvas
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
imagealphablending($image, false);
|
||||
imagesavealpha($image, true);
|
||||
|
||||
if ($width > $this->width || $height > $this->height) {
|
||||
if ($width > $this->width or $height > $this->height) {
|
||||
$bgcolor = is_null($bgcolor) ? '000000' : $bgcolor;
|
||||
imagefill($image, 0, 0, $this->parseColor($bgcolor));
|
||||
}
|
||||
|
@ -547,6 +547,18 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$transparency_2 = $img->pickColor(899, 699, 'array');
|
||||
$this->assertEquals(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0.0), $transparency_1);
|
||||
$this->assertEquals(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0.0), $transparency_2);
|
||||
|
||||
// preserve transparency when resizing canvas
|
||||
$img = new Image('public/circle.png');
|
||||
$img->resizeCanvas(40, 40, 'center');
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||
$this->assertInternalType('int', $img->width);
|
||||
$this->assertInternalType('int', $img->height);
|
||||
$this->assertEquals($img->width, 40);
|
||||
$this->assertEquals($img->height, 40);
|
||||
$this->assertEquals(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0.0), $img->pickColor(0, 0, 'array'));
|
||||
$this->assertEquals(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0.8), $img->pickColor(20, 20, 'array'));
|
||||
|
||||
}
|
||||
|
||||
public function testCropImage()
|
||||
|
Loading…
x
Reference in New Issue
Block a user