Link to the script via this manner:
<img src="myscript.php?src=myimage.jpg">
then use the following code in myscript.php:
<?PHP
$filename = ((@$_GET['src']) ? $_GET['src'] : "");
if($filename == "") die('no src= tag');
header("Cache-Control: must-revalidate");
$offset = 60 * 60 * 24 * 3;
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
header($ExpStr);
$fp = fopen("/path/to/images/$filename", "rb");
fpassthru($fp);
?>
NOTE: This script loads files based on user-input. You should implement checking methods to make sure they didn't manually type in ".." (goes to parent directory) to include scripts you don't want them to. [man]dirname[/man] and [man]realpath[/man] provide ways to take a string and make sure it is in the directory you want it to be in.