I was always puzzled at how some sites can use one script as the src for the images, and it will pull it from a database of information on what file it needs and how to access it.

what my question is how you can do this

PHP Code:
<img src="image.php?imgid=29023"
and have it return and image in a certain folder, but still hav that if you view the source. I have fried fopen, but that doesnt work. I havent found much on the subject, so I thought I would ask. If you want to see the code for finding it, here is a sample.

PHP Code:
if ( isset($imgid) ) {
    
$imginfos=$DBO->query_first("SELECT sku FROM items WHERE sku='$imgid'");
    
$imginfo=$imginfos[sku];
    
// readfile("$imginfo");
    
@fopen ("/home/store/stock/".$imginfo.".gif""rb");
} else {
    @
fopen ("/home/store/stock/blank.gif""rb");

as you can see I also tried readfile, but I am not too sure on how to use it.