ADD WATERMARK TEXT ON IMAGE USING PHP


This tutorial i am explain about how to add the watermark text on image using php. This concept is important because if you want to protect your image you just add your watermark text on the image then the person cant able to copy your image. if others copied your image also it will display with your watermark text.It is very essential concept for developers to add watermark text on the image to avoid the image copying.

add watermark text on image


addwatermark.php


<?php
  header('Content-type: image/jpeg'); //SET THE FORMATE OF THE IMAGE
  $jpg_image = imagecreatefromjpeg('images.jpg'); //GIVE LINK FOR SPECIFIED IMAGE
  $color = imagecolorallocate($jpg_image, 500, 500, 500); //GIVE COLOR TO WATERMARK TEXT
  $font_location = 'BROADW.TTF'; //WATERMARK FONT
  $text = "http://www.sanwebtutorials.blogspot.in/"; //WATERMARK TEXT
  $x=200; //X CO-ORDINATE
  $y=800; //Y CO-ORDINATE
  $size=21; //SIZE OF TEXT
  imagettftext($jpg_image,$size, 0, $x, $y, $color, $font_location, $text); //PRINT TEXT ON IMAGE
  imagejpeg($jpg_image); //SEND IMAGE TO BROWSER
  imagedestroy($jpg_image); //DESTROY THE MEMORY
?>



Download Code


Post a Comment

0 Comments