Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serlvet to display image - how to prevent client from "Save As Image" ?

 
Vince Hon
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used a servlet to display a local image file (c:\image.gif) to the client browser:

Code used in the servlet:



This work fine and client can see the image.
However, I would like to protect the image from being saved by the reason. (i,e, client cannot get the image by right-click "save as image" on the browser), how can I do that ?

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65109
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. The image has to be sent to the client machine for display, and once there, there is nothing you can do to protect it.

You could try to disable right click and annoy the hell out of your users, but they can just go into the cache folder and copy it from there. Or on a Mac, just drag-n-dop it from the browser. If worse comes to worse, they could do a screen grab.

Best you can do is to watermark your images so you can prove they were yours.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose you could make an image displaying applet that decrypts the image on the fly for display - that would make it harder (impossible?) to use the browser save-as function, but there is always screen capture software to grab the whole screen.
Bill
 
Sharad Agarwal
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:
I suppose you could make an image displaying applet that decrypts the image on the fly for display - that would make it harder (impossible?) to use the browser save-as function, but there is always screen capture software to grab the whole screen.
Bill


Well, we would be shipping the applet code to the browser. So it would take a developer/hacker of sorts, but it is still far from impossible But I split hairs, a very interesting solution indeed.
[ June 10, 2005: Message edited by: Sharad Agarwal ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic