wood burning stoves 2.0*
The moose likes Servlets and the fly likes Serlvet to display image - how to prevent client from Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Serlvet to display image - how to prevent client from "Save As Image" ?" Watch "Serlvet to display image - how to prevent client from "Save As Image" ?" New topic
Author

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

Vince Hon
Ranch Hand

Joined: Feb 11, 2003
Posts: 117
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


Vince Hon<br /> <br />SCJP 1.4 | SCWCD | SCBCD <br /><a href="http://vincehon.homeip.net:8000/VJW" target="_blank" rel="nofollow">http://vincehon.homeip.net:8000/VJW</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
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

Joined: Sep 11, 2002
Posts: 167
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 ]

Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
 
wood burning stoves
 
subject: Serlvet to display image - how to prevent client from "Save As Image" ?
 
Similar Threads
Display Pdf Content
Play video file frame by frame
wrting multiple JPEG files to a Servlet output stream
How to make sense of my binary data
Passing an object to a Browser