Nik
Nik

Reputation: 4075

How to prevent user from downloading or saving an image?

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?

Upvotes: 4

Views: 17490

Answers (11)

Abel ANEIROS
Abel ANEIROS

Reputation: 6464

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 :-(

Upvotes: 1

Evan Levesque
Evan Levesque

Reputation: 3203

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

Upvotes: 4

FrankCJ
FrankCJ

Reputation: 21

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.

Upvotes: 0

rajmohan
rajmohan

Reputation: 1618

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.

Upvotes: 0

The Scrum Meister
The Scrum Meister

Reputation: 30111

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.

Upvotes: 1

Brooks Moses
Brooks Moses

Reputation: 9527

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.)

Upvotes: 1

mhd
mhd

Reputation: 4687

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.

Upvotes: 2

mario
mario

Reputation: 145482

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.

Upvotes: 4

Victor Zamanian
Victor Zamanian

Reputation: 3180

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).

Upvotes: 3

HoLyVieR
HoLyVieR

Reputation: 11134

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.

Upvotes: 4

deceze
deceze

Reputation: 522034

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.

Upvotes: 31

Related Questions