note 97393 deleted from function.imagecopymerge by danbrown

From: Date: Sun, 18 Apr 2010 02:39:07 +0000
Subject: note 97393 deleted from function.imagecopymerge by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168359@lists.php.net to get a copy of this message
Note Submitter: peterjwest3 at gmail dot com ---- 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); }

« previous php.notes (#168359) next »