views:

253

answers:

13

I'm using asp.net but open to using any language for doing this. I've seen some javascripts that does this but they seem pretty easy to get around.

Is there a reliable way to keep users from downloading an image?

+21  A: 

Don't put it on the website.

Seriously. If you send it to the user to have it displayed to them, then they have the image, and can thus save the image. Relying on the browser to enforce some sort of policy will inevitably end in defeat. If you can view it, you can copy it. The music industry has been learning this lesson the hard way.

Thanatos
watermark the image, or captcha to make sure the image is not being script-robbed.
ggonsalv
+2  A: 

No. In the extreme, they could just take a photo of the screen with a digital camera and take the image that way. But even pressing PrnScrn is usually enough to get around the most advanced techniques.

Dean Harding
+1  A: 

No. They could use web developer toolbar and its image option to view all image paths thus they can download it..

Pandiya Chendur
+2  A: 

No, it's impossible. I have seen scripts/hacks that:

  • Hide images behind other images
  • Disable right clicks, and some keys on the keyboard (annoying)
  • Clean the clipboard (extremely annoying)
  • And more

But none of them will stop a reasonably knowledgeable user from downloading the images.

NullUserException
+2  A: 

The real question is: Why would you want that?

If you're allowing the user to see the image, you shouldn't care if they download it. Maybe the solution is to restrict access to that image, watermark it, or prevent hotlinking if you're ever worried about that.

There are methods to make it more difficult, but as many have pointed, no real way to prevent it.

Chubas
Why? Because I was watching Bill O'reilly today on Fox News (it was on at the gym, not my choice) and I started thinking that if I ever saw him at an air port or something that I would try and get a picture with him where I was discretely throwing "the shocker". If I was able to get such a picture I would want to put it online but not let anyone else have it so that people would have to come to my site to see it. Purely hypothetical. For now...
Abe Miessler
A: 

You can disable mouse right click for noob web user.

Here is the javascript code to disable right click.

<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus ([email protected]) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</script>

source: http://www.dynamicdrive.com/dynamicindex9/noright.htm

Judas Imam
While I appreciate that you're trying to help the OP, please don't advocate for the use of chrome/browser ui breaking javascript.
Bayard Randel
If a user can right click on an image, they've already downloaded it.
Jace Rhea
I thought only advanced users right-click to download images. N00bs like me just drag-and-drop them to their desktop (which this doesn't prevent).
Gabe
So there is nothing to prevent it. Mine just a suggestion
Judas Imam
+2  A: 

Trying to prevent a file on a web site from being copied is like trying to prevent water from being wet.

Jerry Coffin
Aaaahhh. Your nonrhythimic statement rhymed.
lucifer
+4  A: 

Serve your images by creating a matrix of 1 pixel images in a table.

i.e. for a 1024x768 graphic:

<table>
  <tr>
    <td><img src="1_1.png" height="1" width="1"></td>
    ....
    <td><img src="1_1024.png" height="1" width="1"></td>
  </tr>
  .... repeat x768
  <tr>
    <td><img src="1_768.png" height="1" width="1"></td>
    ....
    </td><img src="1024_768.png" height="1" width="1"></td>
  </tr>
 </table>

Seriously, who is going to want to assemble 786432 pixels?

Have fun! :P

Bayard Randel
The user could do a printscreen on that page, paste it in paint, and save the image.
True Soft
True Soft, this really wasn't a serious suggestion :)
Bayard Randel
Lol i like a challenge
Abe Miessler
isn't that it will be very slow? as the browser will send thousands of requests and the server will response thousands of times?
StarCub
+1  A: 

Make the image a hideous primary green and magenta flashing animation, and nobody will want to copy it :-)

Jason Williams
A: 

Can you somehow translate the "image" into a “movie”, whether an animated gif, flash or whatever?

Imagine it as divided into a checkerboard – and then you randomly display say 50% of the squares each displayed frame and hope that that is quick enough to fool the eye into seeing a solid picture ...

I wouldn't bet on it, but with enough computational power (at the client side) it seems like a solid idea.

Even if you publish your algorithm you should be ok if the end-user/potentail-hacker can't get at the random number seed.

LeonixSolutions
Even then, they could just press pause, then printscreen.
lucifer
and they would print a checkerboard with maybe 66% or 75% of the square being black
LeonixSolutions
A: 

You can use http://www.swfir.com/ or show images in SWf and call images in swf through XML.

metal-gear-solid
+1  A: 

Don't display your images if you don't want it to be copied. Hahaha,..

yonan2236
A: 

I am suprised that no suggested adding a watermark ... just some text with your name or URL on it

LeonixSolutions