When in doubt, look how other people do it.
vBulletin does it, so look at their `attachment` table schema.
Note storing images in the database isn't good for gallery purposes.
Usually DB images would be accessed by a script from a url such as:
image.php?id=56
In which image.php will output the image with proper header().
If you are listing 50 images in a gallery, that would be:
image.php?id=x
50 showings, 50 queries. For a gallery it's probably faster storing the images on the server. You can still use a database table to store the info and the path to the images.
|