XML technologies / CSS / CSS Cookbook / Images / Preventing theft of your images

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

Make it harder for people to copy images from your website.

Solution

Use a transparent 1 x 1 pixel GIF as a placeholder and wrap the tag img in an additional element div:

<div class="slide">
  <img src="singlepixel.gif" alt="" />
</div>

Define the actual image as a background through the property background for the tag div. Specify the correct height and width for both the tag div and the tag img:

div.slide {
 width: 500px;
 height: 468px;
 background-image: url(face.jpg);
 background-repeat: no-repeat;
}
.slide img {
 width: 500px;
 height: 468px;
}

Discussion

The 1 x 1 pixel GIF is not strictly necessary. In principle, you can omit the element img entirely and display the image simply as the background of the element div:

<div class="slide"></div>

The transparent image serves only as camouflage. Users think they are downloading the desired image, but actually receive a useless file.

Microsoft’s Image Toolbar

In Internet Explorer 6 for Windows, Microsoft included an Image Toolbar.

This feature lets visitors email, download or print your site’s images with a single click. To prevent this Image Toolbar from appearing, place the following tags meta in the head of your page:

<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="imagetoolbar" content="false" / >

Web developers find it annoying to add code to prevent a particular product from stealing their images. However, because Microsoft’s browser remains the most widespread, developers can do little about it.

No image is truly safe

Even with this solution and the disabled Image Toolbar, your website’s images are not safe from unauthorized copying.

Browsers often save images automatically in a temporary folder so pages can load faster when revisited. These cached images are removed after a specified time or when the browser cache is cleared manually.

Some browsers automatically rename images, however, and most users do not even know where cached images are stored on their computer.

The easiest way to copy an image is often to take a screenshot, then crop out the desired graphic in any image editor.

These methods may deter some users from unwanted image downloads, but no solution is 100% secure.

  

 

 

 

back to top