There are probably solutions to this revolving around the web server, but to do it with php, you simply call a script as the src ..
<img src=picstript.php?pic=flowers.gif>
Your script should check that the referring URL is what you'd expect (although it's not too hard to spoof this so don't rely on it) and then
a) Determine the type of image/file,
b) Check to see if it exists,
c) Send the header for that file type (eg header("Content-type: image/gif\r\n"); for gifs)
and finally,
d) Read the file from disc and echo it out ..