LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-07-2010, 03:10 AM   #1
chobong
Member
 
Registered: Jan 2010
Posts: 90

Rep: Reputation: 15
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!!
 
Old 09-07-2010, 04:32 AM   #2
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
For Firefox you can manage the image loading parameter in Edit/Preferences/Content, the Load images automatically box with possible Exceptions... for trusted sites.
 
Old 09-07-2010, 04:46 AM   #3
chobong
Member
 
Registered: Jan 2010
Posts: 90

Original Poster
Rep: Reputation: 15
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...

Last edited by chobong; 09-07-2010 at 04:47 AM.
 
Old 09-07-2010, 07:57 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
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
 
Old 09-07-2010, 09:14 PM   #5
chobong
Member
 
Registered: Jan 2010
Posts: 90

Original Poster
Rep: Reputation: 15
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.
 
Old 09-07-2010, 10:40 PM   #6
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
Quote:
Originally Posted by chobong View Post
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
 
Old 09-07-2010, 11:15 PM   #7
chobong
Member
 
Registered: Jan 2010
Posts: 90

Original Poster
Rep: Reputation: 15
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.

Last edited by chobong; 09-07-2010 at 11:19 PM.
 
Old 09-11-2010, 04:36 PM   #8
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
Quote:
Originally Posted by chobong View Post
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.
 
Old 09-11-2010, 10:06 PM   #9
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Rep: Reputation: 18
Try blocking *.img jpgs ... with squid.
 
Old 09-13-2010, 09:03 PM   #10
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,272
Blog Entries: 28

Rep: Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124
Quote:
Originally Posted by chobong View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Page Problem Displaying Image metallica1973 Linux - Software 1 10-06-2008 08:42 PM
Displaying web images as background image on desktop Jarkandu Fedora 1 01-18-2007 04:49 AM
How to prevent KDM from displaying the last user logged in smithtodda SUSE / openSUSE 4 05-23-2005 07:57 PM
Displaying GML in Konqueror browser TechiePerson Linux - Software 0 12-12-2004 11:40 AM
How to prevent caching from web browser? w0000422 Programming 3 01-14-2004 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration