note 90471 modified in function.imagecopymerge by danbrown

From: Date: Thu, 23 Apr 2009 23:31:13 +0000
Subject: note 90471 modified in function.imagecopymerge by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153641@lists.php.net to get a copy of this message
Add logo on image script. <?php /** * Put logo on low right jpeg image * used stefan's script for position **/ $logo_file = "logo.png"; $image_file = "img.jpg"; $targetfile = "img2.jpg"; $photo = imagecreatefromjpeg($image_file); $fotoW = imagesx($photo); $fotoH = imagesy($photo); $logoImage = imagecreatefrompng($logo_file); $logoW = imagesx($logoImage); $logoH = imagesy($logoImage); $photoFrame = imagecreatetruecolor($fotoW,$fotoH); $dest_x = $fotoW - $logoW; $dest_y = $fotoH - $logoH; imagecopyresampled($photoFrame, $photo, 0, 0, 0, 0, $fotoW, $fotoH, $fotoW, $fotoH); imagecopy($photoFrame, $logoImage, $dest_x, $dest_y, 0, 0, $logoW, $logoH); imagejpeg($photoFrame, $targetfile); echo '<img src="'.$targetfile.'" />'; ?> --was-- Add logo on image script. <? /** * Put logo on low right jpeg image * used stefan's script for position **/ $logo_file = "logo.png"; $image_file = "img.jpg"; $targetfile = "img2.jpg"; $photo = imagecreatefromjpeg($image_file); $fotoW = imagesx($photo); $fotoH = imagesy($photo); $logoImage = imagecreatefrompng($logo_file); $logoW = imagesx($logoImage); $logoH = imagesy($logoImage); $photoFrame = imagecreatetruecolor($fotoW,$fotoH); $dest_x = $fotoW - $logoW; $dest_y = $fotoH - $logoH; imagecopyresampled($photoFrame, $photo, 0, 0, 0, 0, $fotoW, $fotoH, $fotoW, $fotoH); imagecopy($photoFrame, $logoImage, $dest_x, $dest_y, 0, 0, $logoW, $logoH); imagejpeg($photoFrame, $targetfile); echo '<img src="'.$targetfile.'" />'; ?> http://php.net/manual/en/function.imagecopymerge.php

« previous php.notes (#153641) next »