Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

php image protection

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Maps API and PHP 25 49
How do I fix this UPDATE error? 7 32
check mysql insert 12 26
Ajax and PHP 9 29
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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