Posts

Showing posts from May 19, 2010

Watermark Images with Text Using PHP and GD Library

Image
Hi This code snippet allows you to watermark uploaded images on the fly. The script saves the uploaded image in the specified location, the prints the specified message (for example a copyright notice) on the image and saves the watermarked image as a JPEG file in another location. You can use this script to copy-protect your images by permanently imprinting a copyright notice on the image. Though the example script covers most general needs, PHP programmers should customize the script for their needs. The Complete Example The working code sample consists of the following items: HTML form that posts an image to the PHP script The PHP Script HTML Form The HTML form needs a file upload element :< input type="file"> . You must also specify the correct encoding type:  enctype="multipart/form-data"  for the form. <form action="watermark-image.php" method="post" enctype="multipart/form-data">  Select a file to upload for pro...