Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint:
Watermark Images on the Fly in PHP
Sep 07, 2004 @ 11:40:50

When you've worked up that perfect site, complete with image galleries of your custom works, the last thing you want is for people to just come along and take what's rightfully yours. Well, with a little help from SitePoint, making sure that the images on your site are watermark-protected.

PHP 4+ and GD 2.0+ represent a powerful combination when it comes to creating or altering images dynamically. In this tutorial, we'll look at some of the GD and standard PHP functions as we watermark images on the fly.

The script, just 13 lines in length, begins with a header() call to tell the Web browser that we are going to output an image in JPEG format. Without this line, a page calling the script via the HTML img tag will receive a broken image and, if the script is accessed directly, the user will see the image data as plain text.

With this very simple script and the right watermark image, you can protect your images from being thrown all over the internet by the more unscrupulous users out there...

tagged:

Link:


Trending Topics: