I need to create a watermark apply it on a picture and save it with a different name . The current script works pretty well but the only problem is that I need to increase t
Why use a stamp at all? I use the following code on one of my sites:
$im = imagecreatefromjpeg($path);
function shadow_text($im, $size, $x, $y, $font, $text)
{
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, $size, 0, $x + 1, $y + 1, $black, $font, $text);
imagettftext($im, $size, 0, $x + 0, $y + 1, $black, $font, $text);
imagettftext($im, $size, 0, $x + 0, $y + 0, $white, $font, $text);
}
$font = '../fonts/verdana.ttf';
$size = 11;
# calculate maximum height of a character
$bbox = imagettfbbox($size, 0, $font, 'ky');
$x = 8; $y = 8 - $bbox[5];
$text = 'text to be added';
shadow_text($im, $size, $x, $y, $font, $text);
header("Content-Type: image/jpeg");
imagejpeg($im, null, 90);
This code runs fast enough that we use it to add dynamic labels on the fly to photos from our photo section as they're downloaded, rather than save them to disk.