Main Content

Protecting images from theft

Archive - Originally posted on "The Horse's Mouth" - 2006-05-12 06:18:52 - Graham Ellis

You want people to visit your website, see your wonderful product and be sold on what you have to offer through wonderful pictures. But you don't want them to take copies of the pictures and use them on their own web sites, nor do you want them to link in to your images and use your costly artwork and bandwidth for their own purposes. Right? It's a bit of a conundrum, isn't it?

The graphics on our website aren't our bread-and-butter living, so I don't mind the odd image being copied or even people using a selection of images - but what if my images were my livelihood? Here are some of the techniques I would look at:

a) Marking the images in some way - either a logo in one corner, or a watermark across the picture. On colour mapped formats, the water mark could be in "white on white" so that it wouldn't be visible to the naked eye, but could be seen via certain software. Some images formats also allow for annotation in their headers.

b) Supplying the online images only at a lower resolution as needed by the web page. This will cut down on theft for print, but the resolution might not be a problem for a web site thief. PHP includes a thumbnailing capability - sample code - which means you can store high resolution on the server but only provide low res on the fly.

c) Image splitting, where images are held in multiple images. Try to copy the whole image below onto your web site - you won't find it as easy as usual ;-) :



Once again, PHP can help you with the setup.

The techniques I have listed above all effect what's sent to the client when the graphics are being displayed, but there are some other server based techniques you could use if you've got a setup where you can front your images with PHP. Indeed, it can be much more efficient too for you to store large numbers of images in a MySQL database (or other database) rather than in a file-and-folder structure where the operating system efficiency isn't brilliant with tens of thousands of files!

d) Track and log image requests in your PHP by incoming IP address, and once a certain IP address has requested more then 20 images in a five minute period (say), start adding watermarks to the pictures through the PHP.

e) Check the referer field, and only supply unwatermarked images where the referer is a know page on your own site.

You need to code these facilities carefully bearing in mind that you may WANT spiders like Google images to grab all your pictures, and you won't want to piss off your very interested genuine customers who call up a lot of pages in their excitement with your site. Also remember that people can go to the trouble of falsifying headers if they want. You may come up with a scheme that logs image requests, and simple emails you the first time there's an unusual referer from another site, allowing you to put in a "watermark" or even "this image is stolen" response when the same remote image request comes up again.