How to prevent user from downloading or saving an image?

后端 未结 11 1021
情深已故
情深已故 2020-12-06 20:39

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 b

相关标签:
11条回答
  • 2020-12-06 21:12

    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.

    0 讨论(0)
  • 2020-12-06 21:13

    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.

    0 讨论(0)
  • 2020-12-06 21:13

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

    0 讨论(0)
  • 2020-12-06 21:14

    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.

    0 讨论(0)
  • 2020-12-06 21:15

    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

    0 讨论(0)
  • 2020-12-06 21:15

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

    0 讨论(0)
提交回复
热议问题