I used this script to add watermark image on the picture uploaded to my previous site. Very nice script.

*** Use this code anyway you want. Credit to Simon Jansson, author of the script. ***

============================
WATERMARK.PHP
============================

<?php
// NOTE: class is experimental
// Copyright (c) 2006, Simon Jansson &lt;http://www.litewebsite.com&gt; all rights reserved.
// License &lt;http://litewebsite.com/license_BSD.html&gt;

//liteStamp::GDversion();
//$stamp = new LiteStamp('originalImage.jpg', 'stampImage.jpg', 'stamp_');
//$stamp-&gt;stampPicture();

class LiteStamp{

// class variables
private $fileHandle = null;
private $newPictureName = null;
private $pictureInfo = null;
private $pictureName = null;
private $prefix = null;
private $stampInfo = null;
private $stampName = null;
private $stampXpos = null;
private $stampYpos = null;

function __construct($picture, $stamp, $prefix = 'stamp_'){

$this-&gt;pictureName = $picture; // original picture to place stamp/watermark on
$this-&gt;stampName = $stamp; // stamp/watermark picture
$this-&gt;prefix = $prefix; // prefix of new stamped picture

}// end of construct

public static function GDversion(){

// GD 2.0.28 or newer is recommended version to use
// http://www.php.net/manual/en/function.gd-info.php
var_dump(gd_info()); // dump information about your GD version

return true;
}// end of GDversion

private function openImage($fileName, $type){

// open picture with correct image function. Add more types if needed.
// GIF: http://php.net/manual/en/function.imagecreatefromgif.php
// JPG/JPEG: http://php.net/manual/en/function.imagecreatefromjpeg.php
// PNG: http://php.net/manual/en/function.imagecreatefrompng.php
switch ($type){

case 1: // GIF
$this-&gt;fileHandle = imagecreatefromgif($fileName);
break;// case 1

case 2: // JPG/JPEG
$this-&gt;fileHandle = imagecreatefromjpeg($fileName);
break;// case 2

case 3: // PNG
$this-&gt;fileHandle = imagecreatefrompng($fileName);
break;// case 3

default:
die('Unsupported filetype: '.$fileName);
}

return $this-&gt;fileHandle;
}// end of openImage

public function stampPicture(){

// get picture info such as width, height and extension
// http://php.net/manual/en/function.getimagesize.php
$this-&gt;pictureInfo = getimagesize($this-&gt;pictureName) or die('Error getting picture info. Double check file path.');
$this-&gt;stampInfo = getimagesize($this-&gt;stampName) or die('Error getting stamp info. Double check file path.');

// open images with class method openImage()
$this-&gt;pictureFile = $this-&gt;openImage($this-&gt;pictureName, $this-&gt;pictureInfo[2]);
$this-&gt;stampFile = $this-&gt;openImage($this-&gt;stampName, $this-&gt;stampInfo[2]);

// position the stamp in the lower right corner
$this-&gt;stampXpos = $this-&gt;pictureInfo[0] - $this-&gt;stampInfo[0] - 15; // width - width - margin
$this-&gt;stampYpos = $this-&gt;pictureInfo[1] - $this-&gt;stampInfo[1] - 15; // height - height - margin

// set a new name for the stamped picture and keep the original picture intact
$this-&gt;newPictureName = $this-&gt;prefix.$this-&gt;pictureName;

// alpha blending: http://php.net/manual/en/function.imagealphablending.php
imagealphablending($this-&gt;pictureFile, true);

// merge the two images: http://php.net/manual/en/function.imagecopymerge.php
imagecopymerge($this-&gt;pictureFile, $this-&gt;stampFile, $this-&gt;stampXpos, $this-&gt;stampYpos, 0, 0, $this-&gt;stampInfo[0], $this-&gt;stampInfo[1], 100);

// output the stamped image as GIF, JPG/JPEG or PNG. Add more types if needed.
// default type is the same as the original file
// GIF: http://php.net/manual/en/function.imagegif.php
// JPG/JPEG: http://php.net/manual/en/function.imagejpeg.php
// PNG: http://php.net/manual/en/function.imagepng.php
switch ($this-&gt;pictureInfo[2]){

case 1: // GIF
imagegif($this-&gt;pictureFile, $this-&gt;newPictureName);
break;// case 1

case 2:// JPG/JPEG
imagejpeg($this-&gt;pictureFile, $this-&gt;newPictureName);
break;// case 2

case 3: // PNG
imagepng($this-&gt;pictureFile, $this-&gt;newPictureName);
break;// case 3

default:
die('Unsupported filetype: '.$fileName);

}

return true;
}// end of stampPicture

function destruct(){
unset($fileHandle, $newPictureName, $pictureInfo, $pictureName, $prefix, $stampInfo, $stampName, $stampXpos, $stampYpos);
}// end of destruct

}// end of class
?>

<?php
$stamp = new LiteStamp('location_map2.gif', 'watermark.png', 'stamp_');
$stamp-&gt;stampPicture();
?>