Solved

php image protection

Posted on 2010-09-06
2
359 Views
Last Modified: 2013-12-13
i have asked this question before on experts exchange but didn't get right answer.

here is the problem.

i am showing an image on page but i don't want people to download it. what i have done right now is disabled right click so that naive users cannot download directly, but i know disabling right click is like no protection at all. so i want a system where images are produced by php file like say i call

<a href="imahe.php?src=image.jpg">thumbnail</a>

and image is produced but if some one accesses the script directly then he should get blank screen. previously i used sessions. when file was being accessed from my gallery page session['show'] is set to1 but when it is accessed directly session['show] is set to 0 and it was working well for me. but i found this plugin for firefox .. coolpreviews which gave user ablity to show download image no matter what.

don't know if i am being very clear here or not. but i would like if some one could help me with it.
thanks in advance
0
Comment
Question by:nandananushil1
2 Comments
 
LVL 4

Accepted Solution

by:
Jezbit earned 500 total points
ID: 33613287
It's extremely difficult to prevent people that really want a copy of your image... consider a screenshot tool, no script will block it.

Check out this link for some decent ideas though: http://www.webresourcesdepot.com/10-ways-to-protect-images-from-being-stolen/

There are some additional PHP solutions listed... watermarking is probably the best solution, that way even if it is copied (downloaded or screenshot), your watermark will be there.
0
 
LVL 10

Expert Comment

by:racmail2001
ID: 33616977
another way to do what you whant it's to try to see in your script who it's accesing the script - if it's the ip of your webserver then it's on if it's another ip then block it.

you can use the $_SERVER['REMOTE_ADDR'] to find out the adress of the client that it's trying to access your script

the basic ideea is like

if ($_SERVER['REMOTE_ADDR']==$your_server_ip){
// display the image

}else{
echo "you don't have rights to see this image";
}


hope this helps
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now