Here is want I'm trying to do. I want to store images in a database (many small ones). Then I want to be able to use a simple tag like <img src=http://www.here.com/showpic.php?id=33> when I want to get that image back out and display the image.
Then the code would be like (I'm just tossing this together, I actually want to do more processing):
< ?
$result = db_query("SELECT image_type, image_data FROM sometable WHERE pic_id = '%d'", $id);
$i = db_fetch_object($result);
Header("Content-type: image/{$i->image_type}");
echo $i->image_data;
? >
That's all I want to display..Just the header and image data.
Is there way I can simply do this using the drupal system, or I do I need to wrap this around a seperate system to make the DB connections, etc.
It would be nice to use this as a function within the module that uploads/handles the images. Any ideas? I'm not sure which hook to use to remove the other content, or other drupal function. So, maybe the img src tag would be: www.here.com/mymodule/display/33 and act much like the other URLS of drupal.
I'd appreciate any pointers.
-Mitch