1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 17:19:50 +02:00

fixed issue with inserting transparent images

This commit is contained in:
Oliver Vogel
2013-11-06 19:29:55 +01:00
parent 49b817a459
commit b88450a325
2 changed files with 16 additions and 0 deletions

View File

@@ -808,8 +808,12 @@ class Image
break;
}
imagealphablending($this->resource, true); // enable alphablending just for imagecopy
imagecopy($this->resource, $obj->resource, $pos_x, $pos_y, 0, 0, $obj->width, $obj->height);
imagealphablending($this->resource, false);
return $this;
}

View File

@@ -888,6 +888,18 @@ class ImageTest extends PHPUnit_Framework_Testcase
$img->reset();
}
public function testInsertAfterResize()
{
$watermark = 'public/circle.png';
$img = Image::make('public/test.jpg');
$img->resize(50, 50)->insert($watermark, 0, 0, 'center');
$this->assertEquals($img->width, 50);
$this->assertEquals($img->height, 50);
$this->assertEquals('#ffffff', $img->pickColor(0, 0, 'hex'));
$this->assertEquals('#322715', $img->pickColor(24, 24, 'hex'));
$this->assertEquals('#ffa600', $img->pickColor(49, 49, 'hex'));
}
public function testInsertImageFromResource()
{
$resource = imagecreatefrompng('public/tile.png');