note 115461 added to function.imagecopymerge

From: Date: Mon, 28 Jul 2014 15:06:44 +0000
Subject: note 115461 added to function.imagecopymerge
Groups: php.notes 
Request: Send a blank email to php-notes+get-200062@lists.php.net to get a copy of this message
Hi everyone I'm using Sina Salek's function with a small improvement to just to free up memory. <?php function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct){ // creating a cut resource $cut = imagecreatetruecolor($src_w, $src_h); // copying relevant section from background to the cut resource imagecopy($cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h); // copying relevant section from watermark to the cut resource imagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h); // insert cut resource to destination image imagecopymerge($dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct); // free up memory. imagedestroy($cut); } ?> Also I thought t'hat it was necessary to define the function puting an '&' before the $dst_im but it's not. This is because the variable is a resource and we aren't changing it's value at all. ---- Server IP: 72.52.91.14 Probable Submitter: 81.184.87.80 ---- Manual Page -- http://php.net/manual/en/function.imagecopymerge.php Edit -- https://master.php.net/note/edit/115461 Del: integrated -- https://master.php.net/note/delete/115461/integrated Del: useless -- https://master.php.net/note/delete/115461/useless Del: bad code -- https://master.php.net/note/delete/115461/bad+code Del: spam -- https://master.php.net/note/delete/115461/spam Del: non-english -- https://master.php.net/note/delete/115461/non-english Del: in docs -- https://master.php.net/note/delete/115461/in+docs Del: other reasons-- https://master.php.net/note/delete/115461 Reject -- https://master.php.net/note/reject/115461 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200062) next »