note 97393 added to function.imagecopymerge
| From: | peterjwest3 at gmail dot com | Date: | Sat, 17 Apr 2010 16:05:07 +0000 |
| Subject: | note 97393 added to function.imagecopymerge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168350@lists.php.net to get a copy of this message | ||
Here is a modified version of Sina's function with better comments, the redundant code removed
and the minor error corrected (inversion of opacity):
<?php
//PNG alpha channel support for imagecopymerge()
//Works because imagecopy() supports alpha
function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h,
$pct) {
//Creates a portion of the destination image and superimposes the source image onto it
$portion = imagecreatetruecolor($src_w, $src_h);
imagecopy($portion, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h);
imagecopy($portion, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h);
//Then superimposes this on the original image, using the defined transparency
imagecopymerge($dst_im, $portion, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct);
}
----
Server IP: 69.147.83.197
Probable Submitter: 92.24.63.8
----
Manual Page -- http://www.php.net/manual/en/function.imagecopymerge.php
Edit -- https://master.php.net/note/edit/97393
Del: integrated -- https://master.php.net/note/delete/97393/integrated
Del: useless -- https://master.php.net/note/delete/97393/useless
Del: bad code -- https://master.php.net/note/delete/97393/bad+code
Del: spam -- https://master.php.net/note/delete/97393/spam
Del: non-english -- https://master.php.net/note/delete/97393/non-english
Del: in docs -- https://master.php.net/note/delete/97393/in+docs
Del: other reasons-- https://master.php.net/note/delete/97393
Reject -- https://master.php.net/note/reject/97393
Search -- https://master.php.net/manage/user-notes.php