0

I want to load image into <img src"..."/> and hide it's original source. Or - to cypher. Is there any possible solutions?

UPDATE: I want to do it, because I do not want that user could find original source of image and get to it.

May be there could be the way to save it to temporary location, rename it with random letters and then use the image?

ValRus
  • 119
  • 1
  • 1
  • 11

3 Answers3

2

Now that the question is clarified, my best guess would be to download the image to your server and then use some kind of hotlink protection to prevent users from access it directly. See http://www.htaccesstools.com/hotlink-protection/ for more information. You might need another solution depending on your technology (server/programming language)

Robert Falkén
  • 2,287
  • 2
  • 16
  • 16
1

One thing you can try is to use a canvas element, then load your image into the canvas via javascript. Then get the datauri of the canvas and set that as the value of your img src.

Fisch
  • 3,775
  • 1
  • 27
  • 38
  • Would need to make a request for the image though, so it would still be possible for the user to get the source of the image. – Robert Falkén Jul 05 '14 at 09:30
  • That is possible, can not argue, but that is not straight forward and the regular user will not be able to do that. It is not like they press cntl+u and get the source... right? – ValRus Jul 05 '14 at 10:00
  • 1
    It makes it harder, definitely. So if that it's enough, then go with it :) Be aware that IE8 doesn't support canvas though, if that's an issue. – Robert Falkén Jul 05 '14 at 10:10
0

No. Any img element results in an HTTP request for that image resource. This is easily trackable in most browsers.

Niels B.
  • 5,912
  • 3
  • 24
  • 44