Some time ago, I had a problem with people stealing the pictures I put online and using them on their own web pages without permission. I have to say it annoyed me a great deal. I wasn't sure what to do to fix the problem, so as a temporary solution, I closed off access to my photo gallery online. I didn't want to use watermarks, as I wanted to detract from the photos as little as possible. If you are interested in my ranting and raving about the problem, you can read it on my weblog
.
In any event, I finally found a solution that I thought I'd share with all of you, as I'm sure this is a problem you've had to deal with. The goal was simple: prevent people from being able to right-click and save my pictures. I didn't want to use some Javascript solution, as there are ways around them and scripts that change the default behavior of buttons can be annoying. The solution I discovered uses CSS (Cascading Style Sheets) to "hide" the picture. I think some online photo gallery systems use this technique.
The following is a description for the HTML and CSS-inclined. Normally, one would have a picture on a web page with a simple img command:
<img src="myphoto.jpg" width="300" height="200" />.
Instead of this, what one can do is tell the image to be blank and make the background of the picture the image you want. This looks more like:
<img style="background:url(myphoto.jpg)" src="blank.gif" width="300" height="200" />.
The blank.gif image should be a 1x1 pixel transparent gif file. This way, the image in the background is visible. If someone right clicks and tries to store the picture, though, they will only get blank.gif. The other step you have to take is to have hotlinking disabled on your web server and/or photo gallery. Otherwise, someone could look at the HTML for your page, find the name of the picture, and then type in the address directly.
I've now implemented this method in my online photo gallery by altering the Gallery
code to put photos in the CSS background style. If anyone wants copies of the altered files for their own use, let me know and I can provide them. Note that this method will not prevent someone from using the print screen button to capture a picture. I figure, though, that the print screen option is one only the most determined of web users will use; my goal was to stop the Myspace and Xanga teenagers who didn't respect my rights to my pictures.
In any event, I hope some of you find this helpful for your own online photo galleries! If you have an comments (or find a way to break this technique), I'd love to hear them.

