Solved

php image protection

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 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

13 Experts available now in Live!

Get 1:1 Help Now