Solved

php image protection

Posted on 2010-09-06
2
360 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 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