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:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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');
|
||||
|
Reference in New Issue
Block a user