Solved

php image protection

Posted on 2010-09-06
2
363 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
[X]
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
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

Industry Leaders: 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!

Question has a verified solution.

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

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…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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.
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 …

627 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