• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to hide image path in JSP

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I want to hide image path which we are displaying on our website i.e. any user when do right click and view source, the path should be in encrypted form.
So that whenever anyone copy the image url and copy that url in any browser the image should not display.

We display our image in following way

<img src="http://www.abc.com/3562356.jpg" width="150" height="150" ></img>

Where www.abc.com is a server in which all these .jpg files are uploaded.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no way to accomplish this. If the browser can show the image, it is available to the end user.

You can make it harder to download the image, but you cannot prevent it.

(And please, don't even think of trying to do something as silly as disabling right-click.)
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can have the image resource served by a servlet and use an identifier for the image that has nothing to do with the file name.

You might encrypt the name with the session ID, thus the link would be useless after the user left the session.

Bill
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have seen people do things in that servlet like checking the referrer header, to ensure that the request is coming from the page in which the image is supposed to appear and from nowhere else.

Of course the referrer header can be faked, but it's like Bear said, you can't prevent people from accessing the image, you can only make it harder.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use say a servlet to display the image or perform some weird doohickey like make an AJAX call with a HTTP header that uniquely identifies your request. But these can be faked.

you can only make it harder.



Very true
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I strongly suspect (only because 99.99999% of the times that this question is asked this is true) that the OP wants to prevent people from saving the image to their own systems. So no matter what gyrations are used to present the image in the browser, once it's visible in the browser, the user can save the image to their system.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:I strongly suspect (only because 99.99999% of the times that this question is asked this is true) that the OP wants to prevent people from saving the image to their own systems. So no matter what gyrations are used to present the image in the browser, once it's visible in the browser, the user can save the image to their system.



Not to mention proxies that could cache an image, if you are worried about image theft.

Just saying that is something to consider based on what the OP wants
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah ... Bear said it right...Once displayed in browser .. no one can stop the person from saving it...
Even if you use scripts ... one can take a screenshot and crop out the required image out of it....
 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic