LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Please help to prevent displaying image on web browser (https://www.linuxquestions.org/questions/linux-newbie-8/please-help-to-prevent-displaying-image-on-web-browser-830730/)

chobong 09-07-2010 03:10 AM

Please help to prevent displaying image on web browser
 
Dear All,

Im looking for how to disable displaying image on web browsers.
Example I have a link http://mydomain.com/img/test.jpg.
- when I connect to this link on my browser, it will not display the image
- But I can use <img src="/img/test.jpg" to websites can read it.

I searched on google but I haven't found the solution.
Please help me to solve this problem!

Thank you so much!!

berbae 09-07-2010 04:32 AM

For Firefox you can manage the image loading parameter in Edit/Preferences/Content, the Load images automatically box with possible Exceptions... for trusted sites.

chobong 09-07-2010 04:46 AM

Uhm, I mean configuration at serverside, not web browser.
Anyway, thanks berbae

Can i modify the httpd.conf file with mod_rewrite for this problem?
I tried with
Code:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain/.*$ [NC]
RewriteRule ^.*\.(jpg|jpeg|png)$ - [F]

But it only prevented displaying the image when conncect to other websites which used <img src="http://mydomain/test.jpg">.
When I clicked http://mydomain/test.jpg on my webbrowser, it can still show the image!!

Please help me...

bathory 09-07-2010 07:57 AM

Hi,

I'm afraid that what you want to do is not possible.
Your rewrite code is for preventing other sites hotlinking to your images, by checking the HTTP_REFERER. When this is your own server that does the request, it should be allowed access to the image, or else it will display a webpage without its images

Regards

chobong 09-07-2010 09:14 PM

Thank you so much for your reply, bathory!

Yes, so can I prevent downloading images in httpd.conf?
I don't want use php or javascript because using them make displaying images slower.

joec@home 09-07-2010 10:40 PM

Quote:

Originally Posted by chobong (Post 4090972)
Thank you so much for your reply, bathory!

Yes, so can I prevent downloading images in httpd.conf?
I don't want use php or javascript because using them make displaying images slower.

What you are asking about is called Hotlink Protection. At least to my own knowledge this is done through .htaccess programming, not through the httpd.conf configuration.

Hotlink Protection Tutorial (Apache Server - .htaccess files)
http://www.vbulletin.org/forum/showthread.php?t=122057

chobong 09-07-2010 11:15 PM

Thanks joec :)
What I'm asking not Hotlink Protection, I just want to protect my images from downloading or copying directly.
But this seems impossible.

I found a document relate to this problem at http://apache-server.com/tutorials/ATimage-theft.html
Thank you so much for helping me.

joec@home 09-11-2010 04:36 PM

Quote:

Originally Posted by chobong (Post 4091037)
Thanks joec :)
What I'm asking not Hotlink Protection, I just want to protect my images from downloading or copying directly.
But this seems impossible.

I found a document relate to this problem at http://apache-server.com/tutorials/ATimage-theft.html
Thank you so much for helping me.

Unfortunately that is not possible because when you view an image on a web page it is downloaded in some form or manner, and is always stored on the local computer. The only alternative I have seen are flash programs that act as a proxy so that only flash proxy program is stored on the local computer. This is a very new technology so I do expect the flash programs to get better as they are further developed.

landysaccount 09-11-2010 10:06 PM

Try blocking *.img jpgs ... with squid.

frankbell 09-13-2010 09:03 PM

Quote:

Originally Posted by chobong (Post 4091037)
Thanks joec :)
What I'm asking not Hotlink Protection, I just want to protect my images from downloading or copying directly.

But this seems impossible.

What you are asking is indeed impossible. For a web user to view an image, the image must first be downloaded to his or her computer. That's how the WWW works.

If a user can see the image in his browser, he or she can make a copy. Even if you disable right-click on the web page, a user can take a screenshot, crop it down, and recreate the image.

The only way to keep others from saving copies of your images is not to put them on the web.

If you are so concerned, you might consider putting a watermark directly in the middle of your images before you post them. That won't keep them from being copied, but it will

1) deter lots of folks from wanting them in the first place and

2) ensure that, if someone does take them, others will know where they came from.


All times are GMT -5. The time now is 08:49 AM.