Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

How can I stop people stealing my blog images and photos?

Is there a command I can use to stop people right clicking and saving copies of my images? I get annoyed when they take my work and post it on their website without permission. Thanks.


Dave's Answer:

This is a bit of a sticky question because it's just about impossible to stop people from getting to your image if they really, really want to. I'll show you a couple of ways to make copying images harder, but just like any other approach to security, it makes things more difficult, not impossible.

For example, you can take a screenshot or screen capture and then trim it down in a graphics editor to get a specific image, even if the image is locked up and hidden away on a page. You could also unwind and decipher the HTML source code to ascertain the URL of a specific image and simply request that URL directly in your browser, thereby sidestepping anything to do with a hiding technique.

But let's look at how to make things more difficult, then I'll suggest a couple of different ways you can perhaps gain advantage by not trying to block people copying your content...

The first and most common way to stop people copying images is to disable the right-click (or, if you're on a Mac, control-click) pop-up menu in the Web browser. There are a variety of different Javascript code solutions floating around, but here's one I tested that worked across just about all the browsers I could try:

<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape")
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
  return false;
}
function mousehandler(e){
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
  if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>

You can see this in action by trying to right-click or control-click on the following image:

American Flag Icon

No menu should pop up (though I believe that this doesn't work in MS IE7)

The problem is, you can still drag the image off your browser screen and drop it onto your Desktop, thereby copying it. But we can address that too with a CSS trick this time: put the image in a single cell table as the background image:

<table>
<tr>
<td style="width:192; height:146; background-image: url(american-flag.gif)">
&nbsp;
</td>
</tr>
</table>

This works by putting the image "behind" all the content on the page, but it's ugly and you have to be sure you have exactly the right dimensions of the image. Nonetheless, try it here:

 

So between the Javascript and the CSS tricks, we've made it quite a bit harder to informally steal the American flag image on this page, which might slow down "drive-by copiers", which might be sufficient for what you need, but it's just a matter of a few seconds to read the source and identify the actual URL of that image (which is http://www.askdavetaylor.com/1-blog-pics/american-flag.gif if you're curious) and bring that image up by itself, and then steal it anyway.

Instead, I suggest that you might want to consider either adding a watermark to your image and not worrying about it, or actually encouraging people to rip off the image by supplying some HTML code immediately below the image, code that includes a link back to your site!

Here's how the first might look:

American Flag Icon: Watermarked

Personally, I find this to be an invasive and rather ugly solution, where everyone who visits the site has to suffer through the anti-piracy measures that you have in place for the precious few who would act inappropriately, so I'm not a fan.

The final way you might deal with the problem is to have a small code box immediately under the image that encourages people to take it including a link back to your site as the source of the image.

Here's an example of how that might look:

American Flag Icon

Add This Image To Your Site: Use our handy HTML code.

Not too horrible, fairly low key, and if they grab all the HTML code, you get a nice backlink for their effort, which is a good thing. Unwrap it all and here's the source code to the above:

<img src="http://www.askdavetaylor.com/1-blog-pics/american-flag.gif" alt="American Flag Icon" /><div style="font-size:85%;"><form><textarea rows="1" cols="40" style="font-size:85%">&lt;img src="http://www.askdavetaylor.com/1-blog-pics/american-flag.gif" alt="American Flag Icon"&gt;&lt;div style="font-size:75%">Image source: &lt;a href="http://www.askdavetaylor.com/">AskDaveTaylor.com&lt;/a>&lt;/div></textarea><br />Add This Image To Your Site: Use our handy HTML code.</div>

So that works, it's nice, but, blech, what a complicated way to add an image. A lot harder than just using the ole' Flickr copy and paste function!

That gives you all the major ways you can solve your image theft problem. I leave it to you, dear reader, to decide which of them, or which combination of them, will work best for you when considering both the effectiveness of the approach and the level of additional work involved in adding images to your site or blog.



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments
Rather amazingly, there are no comments on this article yet.

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]