store your images in a db (mysql works well) in a blob data field.
first send a header information telling browser that content is an image
header("content-type: image/gif");
then query your image
$image_content= mysql_result(mysql_query("select image_source from table where [criteria]"),0,"image_source" );
then simply print it out
print $image_content;
then flush it
flush();
thats all