note 85678 added to function.imagecolortransparent
| From: | cca220v at osu1 dot php dot net | Date: | Thu, 11 Sep 2008 21:47:06 +0000 |
| Subject: | note 85678 added to function.imagecolortransparent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144347@lists.php.net to get a copy of this message | ||
I found out the hard way that for two png's with alpha transparency to correctly stack you need
to explicitly re-enable alpha blending.
$img=imagecreatetruecolor($dx,$dy);
$img1=imagecreatefrompng($png1); //first layer
$img2=imagecreatefrompng($png2); //second layer (smaller image)
imagealphablending($img, false);
$transparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
imagefill($img, 0, 0, $transparent);
imagesavealpha($img,true);
imagealphablending($img, true); //removing this causes the second layer's transparency to go
trough the 1st layer erasing it (the image >is< transparent there ... as is the 2nd layer ...
but not the 1st so it should not be transparent)
imagecopyresampled($img,$img1,
imagecopyresampled($img,$img2,
----
Server IP: 69.147.83.197
Probable Submitter: 89.47.76.126
----
Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php
Edit -- https://master.php.net/note/edit/85678
Del: integrated -- https://master.php.net/note/delete/85678/integrated
Del: useless -- https://master.php.net/note/delete/85678/useless
Del: bad code -- https://master.php.net/note/delete/85678/bad+code
Del: spam -- https://master.php.net/note/delete/85678/spam
Del: non-english -- https://master.php.net/note/delete/85678/non-english
Del: in docs -- https://master.php.net/note/delete/85678/in+docs
Del: other reasons-- https://master.php.net/note/delete/85678
Reject -- https://master.php.net/note/reject/85678
Search -- https://master.php.net/manage/user-notes.php