I got a commission for an "artistic site" that had to protect a large library of images from leeches and downloaders. They wanted to display their images, but not allow anyone to download or link to their images. So, I first had to explain that no image is entirely "safe". Even with the best web security available, a user could use a screen capture utility to snap their screen and throw it into an image editor to capture the image. Needless to say, they weren't happy to hear that, but they wanted me to protect their images as much as possible.
My problem broke down into two problems. Stop normal users from saving the images, and stop file and bandwidth leeches. I'm so thrilled. :glare:
There are javascript options to disable right-click access, but because javascript is a client side scripting languange instead of being server side, users can simply disable scripting and your "security" is disabled as well. This wasn't going to be an option, so I needed a different way to protect my client's images. My answer was to encode the JPG files as they were being uploaded into Adobe Flash SWF files. You can find more detail about it here.
When the user attempts to right click on the image, he gets the SWF menu, instead of an option to download. Unfortunately, there is an option to print, which the client did not want. So, I did a little research and found out how to disable the print function in Flash, but leave the rest of the menu. I posted a quick job up on http://www.scriptlance.com and found someone to edit the PHP code to disable print functionality. You can also disable the right click menu completely, by simply adding menu="false" within the embed and object tags. That took care of my users downloading.
Now for my leeches. I had the flexibility of whom to use for a host for my client and I found an ISP that allowed me to edit my .htaccess file. I found a very elegant solution at http://www.alistapart.com/articles/hotlinking/ that took care of my leech issue, after adding my SWF files into the .htaccess conditions.
Is it a perfect solution? No, but combined with some other tricks, like URL obfuscation, md5 hashing, appending obfucated gobbledy-gook on the end of the image file, session checking for login, etc. , I have a layered solution that makes it extremely difficult for someone to acquire my client's images.
One humorous side effect of converting JPG images to SWF is that Flash's right click menu allows the user to "zoom in" on parts of the "artistic" image. This "feature" was actually appreciated by the client, so they got a bonus!