I have a website I monetize with numerous original pictures on it, I want people to visit the website to see the original pictures and have search engines only show the pictures with transparent watermarks.
The following is an example of what I mean by a transparent watermark. Except of course, I replace "Test!" with the company name.
Here's the PHP code I created so far:
<?php
$txt = "TEST!";
header( "Content-type: image/jpeg", true );
$w = imagefontwidth(5) * ( strlen( $txt ) + 1 );
$h = imagefontheight(5) * 2;
$i2 = imagecreatetruecolor( $w,$h );
imagesavealpha( $i2, true );
imagealphablending( $i2, false );
imagefill( $i2, 0, 0, imagecolorallocatealpha( $i2, 255, 255, 255, 127 ) );
imagestring( $i2, 3, 10, 10, $txt, imagecolorallocate( $i2, 255, 0, 0) );
$i = imagecreatefromjpeg( "someimage.jpg" );
imagecopyresized( $i, $i2, 2, 2, 0, 0, $w * 5, $h * 7, $w, $h );
imagejpeg( $i, null, 100 );
imagedestroy( $i );
imagedestroy( $i2 );
?>
$i2
is the resource variable for the image box in which I added the text, and $i1
is for the large image to place the text on. $w
and $h
represent width and height of the text image box. This code is able to produce the text on top of the image without the background box showing, but it doesn't produce the bump-map effect like what is shown in the above image.
Can anyone guide me as to what functions, mathematics or code I need to use to create the bump-map effect?
I feel my solution requires special manipulation of a block of pixels but I don't know how to do it for this effect.
I also want to stick with the PHP GD Image library.