Location: PHPKode > scripts > Text Watermark > font.php
<?php
function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) {
   list($width, $height) = getimagesize($SourceFile);
   $image_p = imagecreatetruecolor($width, $height);
   $image = imagecreatefromjpeg($SourceFile);
   imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);
   $black = imagecolorallocate($image_p, 0, 0, 0);
   $font = 'dum13d100.ttf';
   $font_size = 10;
   imagettftext($image_p, $font_size, 0, 10, $height-20, $black, $font, $WaterMarkText);
   if ($DestinationFile<>'') {
      imagejpeg ($image_p, $DestinationFile, 100);
   } else {
      header('Content-Type: image/jpeg');
      imagejpeg($image_p, null, 100);
   };
   imagedestroy($image);
   imagedestroy($image_p);
}

$SourceFile = 'myimage.jpg';
$DestinationFile = 'images/myimage-watermark.jpg';
$WaterMarkText = 'CHINMAY';
watermarkImage ($SourceFile,$WaterMarkText,$DestinationFile);
?>
Return current item: Text Watermark