Reputation: 1631
I want to show a set of images only on my website. I want to avoid end-user posibility of easy saving. I know that user can save an image with print screen, but this is not a easy way because require some work after that.
Upvotes: 0
Views: 167
Reputation: 570
It's possible to draw an image to a canvas element, thus stopping a user from saving the image using a DOM inspector or right-click menu. This technique wont work on older browsers though.
Upvotes: 1
Reputation: 36274
You can:
background-image
on a fully transparent gif / png *But the user can still save it with a simple print-screen, as you wrote.
(*) f.ex:
<img src="blank.gif" style="width: 200px; height: 100px; background-image: url('image.jpg');" />
Upvotes: 1
Reputation: 3320
It's impossible to prevent them 100% from doing it, but you can make it harder.
You can have a .htaccess rule which doesn't allow direct access to it (must be loaded from one of your site's webpages)
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
Then you can prevent right clicking on your website so they can't just click copy image. See: How do I disable right click on my web page?
Note there is no good solution.
Upvotes: 1
Reputation: 360872
Upvotes: 1