4

Well, i have a web page where i am displaying few images. But my problem is that i don't want user to download or save those images. I can apply watermark to those images but that is alternative option. I can also disable right click but what if user saves the page?

Any alternative solution will also do?

Hope this question is clear?

Nik
  • 4,015
  • 3
  • 20
  • 16
  • 9
    The user can disable JavaScript to right-click. There is no good alternative solution: If you know the URL to the image, you can download it. – Ming-Tang Dec 22 '10 at 04:20
  • 5
    can't be done, shouldn't be done. – MK. Dec 22 '10 at 04:21
  • Why not a watermark? I'm guessing it's more the reuse rather than the downloading you're trying to prevent. – Bob Kaufman Dec 22 '10 at 04:21
  • @SHiNKiROU : Well i don't want to download but wants to prevent users from downloading. – Nik Dec 22 '10 at 04:24
  • 22
    Make your page in *completely* in flash; add to your flash application a script that will encrypt it with a salted hash if one different timed password, with copies stored in your database and hard-coded in the flash file, isn't passed to it every three minutes by the server; to disable the possibility to take screenshots try using a polarized image - so if the pixels don't align the result will be very ugly. Still, this might not be enough. The best solution in this case is always preventing the user to access your website. – cbrandolino Dec 22 '10 at 04:25
  • @Bob: Thats the alternative solution as i mentioned. But i am looking for better solution if any. – Nik Dec 22 '10 at 04:25
  • If ya dont want thee to download your images, dont show thee. What users can see (text & images) in their browser, can save. – Mudassir Dec 22 '10 at 04:27
  • 3
    @Nik : I'll take a screenshot right now, and then wait for facepalm.stackexchange.com. hm, feeling bad: it was an hyperbole to illustrate the factual impossibility and disastrous potential of such techniques. – cbrandolino Dec 22 '10 at 04:38
  • @cbrandolino : finally, i have decided to go for watermarking. – Nik Dec 22 '10 at 04:44

11 Answers11

31

If the user can see the image, it's already on his computer. Saving it to a file or copying it to the clipboard is trivial and cannot be disabled in any reliable way.

If you want to keep control over the image, don't put it on the internet.
Watermarking is the best you can do.

deceze
  • 510,633
  • 85
  • 743
  • 889
  • +1 "If the user can see the image, it's already on his computer." This is literally true. Use PrtScn if all else fails :) – Halil Özgür Mar 28 '11 at 15:29
  • I think that if the image is encoded in base64 and is provided from the CSS as background, then it's not a file that is being download and "saved" in some cache folder. Anyway, some users demand a bare minimum of protection from actively downloading their images from a website..we as developers know it's pointless, but stupid users know only to demand and demand.. – vsync Jun 09 '14 at 14:52
4

if you are using Apache server, you can disable accessing the image through absolute url
the images can be access only with relative url with this htaccess code :

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]

in addition, disable the right click context using JavaScript, and add a watermark to protect the copy rights
this will reduce the chance of saving the images

Evan Lévesque
  • 3,115
  • 7
  • 40
  • 61
4

If the user can view the image there is no way you can stop him to save it, because at that point you have already sent him to file.

You can implement some pseudo-protection code such as anti Right-Click to "block" the saving, but overall it's just annoying to user of your website and it's always possible to go around it.

If you don't want your image to be propagated, watermark them or don't publish them.

HoLyVieR
  • 10,985
  • 5
  • 42
  • 67
4

Porn website, eh?

Well, you cannot prevent it. You can screw Windows and IE users with a Javascript trick, but as said before, that's easy to disable. You can't stop users from saving of the whole page either. People can also just make screenshot, cut and resave. All resources available via URLs are locateable and can be downloaded.

There's one option to frustrate downloading of images though: automatically slice it. If the image is 800x600 pixel, you could split it into a hundred(?) 80x60 smaller graphics. That would make reassembling slightly more difficult. But also turn the rendering slightly unrealiable.

mario
  • 144,265
  • 20
  • 237
  • 291
  • 1
    FYI, its not Porn website. SO please do not put such remarks. – Nik Dec 22 '10 at 04:32
  • 8
    @Nik: FYI, that was just a joke. It's funny because it's a cliche and nobody would assume it true. – mario Dec 22 '10 at 04:33
  • Sorry if heartened you. but i was desperately looking for solution. Anyway thanks for good suggestion. :) – Nik Dec 22 '10 at 04:41
  • @Nik: No worries. Go with the watermarking, that's the least cumbersome option for you **and the users**. Also: counter-upvoted you. While it's a duplicate question and extremely unpopular topic, it's not a bad one. – mario Dec 22 '10 at 04:44
3

There always seem to be ways to circumvent this, so you shouldn't even bother. I have never been unable to break this type of blocking functionality. If applicable, it's probably better to watermark your images with your name, date and a copyright symbol or (C).

Victor Zamanian
  • 3,100
  • 24
  • 31
2

There's no absolute solution to prevent user from downloading your image. If you publish image in the web,just assume that somebody can copy it. Whatever your solution, in the end user can take a screen shot anyway.

mhd
  • 4,561
  • 10
  • 37
  • 53
1

Prevent users from downloading images it's a waste of time because even if they cannot download the image, they always could do an screenshot :-(

Abel ANEIROS
  • 6,029
  • 2
  • 25
  • 19
1

I've seen a few web pages that put a transparent single-pixel .gif as an overlay across the "main" image that they're displaying, so that when you right-click and save you only save the single-pixel image. I'm not sure of the exact HTML for that, but there are a few obvious ways to do it.

(This, like the other tricks, is not particularly difficult to circumvent, but it does at least add an annoyance factor that will block most people.)

Brooks Moses
  • 9,267
  • 2
  • 33
  • 57
1

As mention in all the answers, there is no way to prevent users from saving the image, however you can try to make it hard for a user to do it.

although this is not good performance, you can split the image into many small pieces, making it harder (but not at all impossible) to save them and join them.

The Scrum Meister
  • 29,681
  • 8
  • 66
  • 64
0

There are so many ways to download images from website, so whatever you do at the end of the day someone is going to download it.

rajmohan
  • 1,618
  • 1
  • 15
  • 36
0

Try to use flash to load your image, use flash to decode your encoded images. And this still can not prevent user to take a screen capture.

FrankCJ
  • 21
  • 4