Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

PHP5: how to prevent users to download images from my site?

Hello Experts,

What is the best way to prevent users from downloading images from my site?

Regards,
0
epifanio67
Asked:
epifanio67
3 Solutions
 
GaryCommented:
Take your website off the internet.

If you don't want to do that then there is nothing you can do about it.
0
 
duncanb7Commented:
Could you do it on .htaccess file instead of php so that users can not access image site ?

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

And the site if let user view the image, in other words, what they view and what they can
download unless don't putting it on servers

Duncan
0
 
epifanio67Author Commented:
hahahahaha...

ok... I realize it is impossible.....
but is there ways I can 'prevent' the image URLs from being used on other sites via htaccess file?

funny.... and I agree...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
epifanio67Author Commented:
sorry duncan.... I must have posted the comment to Gary seconds after you posted yours..

that's what I was looking for....

thanks..

I will wait a few more min for more suggestions...
0
 
GaryCommented:
You can prevent hotlinking

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ stolen_from_my_site.jpg [NC,R,L]

edit:
Actually rowby's solution is similar - I'll leave mine since it gives you the option of redirecting to another image that you can make that says Stolen from mysite.com just to piss the other website off. (but Rowby deserves the main credit)
0
 
Ray PaseurCommented:
You might find this useful. The strategy is to make it impossible for the image to have a direct-to-file URL.
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/A_10065-Adding-a-Watermark-to-an-Image.html
0
 
epifanio67Author Commented:
thank you experts... I truly appreciate your help...

Regards,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now