PDA

View Full Version : Not allowing image save



d-machine
03-14-2014, 03:49 PM
Hi,

What's the easiest way for not allowing saving any image from my site?

Thank you

mlegg
03-14-2014, 05:17 PM
There's always a way to get an image. You should add a watermark to the images so others can't use them.

d-machine
03-14-2014, 05:23 PM
and though what way can you avoid saving images?

mlegg
03-14-2014, 08:49 PM
put this inbetween the <HEAD> tags


<script type='text/javascript' src='http://code.jquery.com/jquery-1.4.4.min.js'></script>
<script type='text/javascript'>//<![CDATA[
$(function(){
$('img').bind('contextmenu', function(e){
return false;
});
});//]]>
</script>

traq
03-15-2014, 03:54 AM
Keep in mind that @mlegg's first answer was more accurate. For example, if you use the script he mentions, I could circumvent it by (off the top of my head) disabling javascript, or I could simply use the [print screen] button on my keyboard. That is, assuming my browser even allows the context menu to be blocked in the first place (which it should not; websites have no business trying to take control of the browser away from the user).

The short answer is: it is not possible. If someone can see the image, they have already downloaded it. The picture is on the user's computer, not on your server. That's just how HTTP works. If you are interested in a more involved discussion on the topic, see here (http://www.dynamicdrive.com/forums/showthread.php?48916-Why-you-cannot-protect-your-source-code-and-files).

kennyd4110
03-15-2014, 09:52 PM
Here are some simple script to disable the right click, they may work to stop the average Joe from getting it. But as stated there are many ways to get a pic from a website. Even some watermarks can simply be cropped out if they only appear in the corner of the pic.

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

http://www.dynamicdrive.com/dynamicindex9/noright2.htm

http://www.dynamicdrive.com/dynamicindex9/noright3.htm

Here's one to block copying text also:

http://www.dynamicdrive.com/dynamicindex9/noselect.htm