I wrote a little bit of code that I stuffed at the very very top of avatar.php, attachment.php and journalpic.php (a self-written image send file much like the other two, used for my own Journal System)...
If you paste an avatar/attachment url in your browser directly, it works (which is
much nicer for your bandwidth than _redirecting them to threads on your site_

), if you use them on other sites however (as part of the HTML page), they won't work and the image you will see there is a fake no-deeplinking-image that you make yourself (mine says "No banana my friend!"

).
It checks the URL to match your own domain but in a more efficient way (the one from this hack can easily be spoofed, thus, it won't work then)
Notes:
a) the {0,15} at the (relative) start will match for subdomain(s) or lack thereof. If you have a subdomain longer than 15 characters, make the 15 number higher

(it also works for
http://yourdomain.com, thus, without
www. )
b) the path directive is a full path towards the image you'll be serving out, check your own host's settings to see what exactly you need to enter there
PHP Code:
if(isset($_SERVER['HTTP_REFERER'])){
if(!preg_match("'^(http://).{0,15}(YOURDOMAINHERE.com)'i", $_SERVER['HTTP_REFERER'])){
$path = "/home/users/yourusername.com/html/YOURDOMAINHERE.com/YOURANTIDEEPLINKINGIMAGE.png";
$filesize = filesize($path);
$fp = fopen($path, "r");
$attachmentinfo['filedata'] = fread($fp, $filesize);
fclose($fp);
header("Cache-control: max-age=31536000");
header("Expires: " . gmdate("D, d M Y H:i:s",time()+31536000) . "GMT");
header("Content-Length: $filesize");
header('Content-type: image/png'); // adjust this if you use a .gif or a .jpg (image/gif || image/jpeg)
echo $attachmentinfo['filedata'];
exit;
}
}
If you do it right, you can fully prevent deeplinking with this if you put it at the start of avatar.php & attachment.php (and any other image serving file you may be using) :up:
Any questions? PM me (I doubt I'll ever see this thread again if I don't get pm'd a question...

)