note 73477 added to function.imagecopymerge

From: Date: Sat, 24 Feb 2007 23:45:35 +0000
Subject: note 73477 added to function.imagecopymerge
Groups: php.notes 
Request: Send a blank email to php-notes+get-123842@lists.php.net to get a copy of this message
Hi i wrote this script to add a watermark image into the bottom right a larger image. Its very basic i know but its all i need for now. It also is an easy function for noobs to grasp. It just takes an two image types as arguments for example $image = imagecreatefromjpeg("FILELOCATION"); $insert = imagecreatefrompng("WATERMARKFILELOCATION"); $image = image_overlap($image, $insert); function image_overlap($background, $foreground){ $insertWidth = imagesx($foreground); $insertHeight = imagesy($foreground); $imageWidth = imagesx($background); $imageHeight = imagesy($background); $overlapX = $imageWidth-$insertWidth-5; $overlapY = $imageHeight-$insertHeight-5; imagecolortransparent($foreground, imagecolorat($foreground,0,0)); imagecopymerge($background,$foreground, $overlapX,$overlapY,0,0,$insertWidth,$insertHeight,100); return $background; } It doesnt smooth the edges between the two images but it works easily. ---- Server IP: 69.147.83.197 Probable Submitter: 203.97.96.54 ---- Manual Page -- http://www.php.net/manual/en/function.imagecopymerge.php Edit -- https://master.php.net/note/edit/73477 Del: integrated -- https://master.php.net/note/delete/73477/integrated Del: useless -- https://master.php.net/note/delete/73477/useless Del: bad code -- https://master.php.net/note/delete/73477/bad+code Del: spam -- https://master.php.net/note/delete/73477/spam Del: non-english -- https://master.php.net/note/delete/73477/non-english Del: in docs -- https://master.php.net/note/delete/73477/in+docs Del: other reasons-- https://master.php.net/note/delete/73477 Reject -- https://master.php.net/note/reject/73477 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123842) next »