Adrian B
Adrian B

Reputation: 1631

How to serve an image without possibility of easy saving it from browser?

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

Answers (4)

thesonglessbird
thesonglessbird

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

pozs
pozs

Reputation: 36274

You can:

  • split it into multiple pieces (require some changes on the HTML code too)
  • apply as a css background-image on a fully transparent gif / png *
  • apply a watermark with gd (in php)
  • or mix these

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

James T
James T

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

Marc B
Marc B

Reputation: 360872

  1. display in an applet (e.g flash, java)
  2. use server-side operations to chop the image up into random-sized squares/rectangles and use a client-side table to display the parts in "assembled" format
  3. use CSS overlays so that right-clicking on the image gets you the overlay instead of the image
  4. give up because if someone wants to steal your image, they will.

Upvotes: 1

Related Questions