| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
<?
//set filename to false to prevent any errors from memory corruption etc
// or in case its used somewhere in a script that includes this file
$filename = false;
if (isset($_GET['id'])){
$result = checkTranslationTable($_GET['id')
$file_name = ($result != false) ? $result : false
if($file_name){}
showMyImage($filename);
}else{
showfail();
exit;
}
}else{
showfail();
}
function showMyImage($filename){
$file_type = substr($file_name,0,-3);//use substr magic to get the ext
header('Content-type: image/'.$file_type);
header('Content-Disposition: attachment; filename="'.$file_name.'";');
readfile($file_name);
}
function showfail(){
/* you can hand out a really effed up image or you can hand out a 404
header( "HTTP/1.0 404 Not Found" );
exit ;
*/
}
function checkTranslationTable($id){
/*
this is where you can check against a DB, global array, or just regular list
etc you may also want to put in place an algorithm that will change alter
the id of the images randomly or even if you just use the time() function to
"randomize" the names, this would really mess with someone who tries to hotlink
because even if they did figure out that the id is changed based on the
time() function, they would have to make their server get in synch with yours
for them to dynamically be able to create the correct id -- which would be
in vain if you have a rewrite rule saying that no other domains are allowed
to "read" from the images directory (see noet below)
*/
)
?>
Well, all these posts are spot on in terms of accuracy. However, if all you are interested is in upping the barrier to ease of stealing your pictures, place a div on top of your image with a transparent gif as it's background. Won't stop a determined thief but may prevent most casual visitors to your site from getting easy access.
Shashwat
On 19-Apr-08, at 9:18 PM, Scott Reynen wrote:
http://lists.apple.com/mailman/options/web-dev/email@hiddenOn Apr 19, 2008, at 9:12 AM, Robert Poland wrote:
[protecting images from download] seem like it should be a simple thing.
It is simple: don't put the image on the web. The web is all about downloading. Everything a browser displays is downloaded first. Trying to control what happens after something is downloaded is both futile and offensive, like sending someone postcard and telling them they can't put it on their fridge.
Peace,
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden
This email sent to email@hidden
_______________________________________________ Do not post admin requests to the list. They will be ignored. Web-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/web-dev/email@hidden This email sent to email@hidden
| References: | |
| >protect images from download (From: Robert Poland <email@hidden>) | |
| >Re: protect images from download (From: Scott Reynen <email@hidden>) | |
| >Re: protect images from download (From: Shashwat Parhi <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.