Firstly create a watermark image and save it as png-24 for best quality.
Firstly of course we want to set the actual image we want to watermark.
$file = $_GET["src"]; // set it to a variable
That will take the source of the image from a variable set in the url, which we will talk about later.
Next we want to create the watermark image and load it up into RAM.
$watermark = imagecreatefrompng("watermark.png");
As i said PNG work best. We do have a problem with using PNG-24 as the new GD doesnt seem to like it. Usally it just gives the image a white background, but we can get around this by doing the following.
Now we want to create the actual image we are adding the watermark to and load it into RAM.
Now we just want to get the height and width of the image so we can place the watermark correctly.
Now we need to set up some variables that will tell us where to place the watermark on the image.
$coordinate_X = ($imageWidth - 5) - ($watermarkWidth);
$coordinate_Y = ($imageHeight - 5) - ($watermarkHeight);
//we want to be at least 5 pixels from the edge, but to make sure
// we shall add abit more so also take away the watermark dimensions
Now its a matter of place the watermark on the actual image.