Hey all,
Sorry if this is a readily answerable question - I have searched extensively so far and have not found an answer yet.
I am designing a fairly extensive website for a client. The site features lots of media, especially pictures. I am stuck deciding how to store the URLs of these pictures.
My first thought was to simply store them in the relevant tables, i.e. product_images, designer_images, user_images, etc. But the redundancy inherent in having a dozen different image tables seems like overkill.
My other option, as I see it, is to have one big "images" table, and store everything there. I could then have an index field that would reference the image's purpose (i.e. it could read something like "prod_id_56", which would tie the image to product number 56). One concern I have is if any metadata has to be stored with the image (like this image is the primary image for product 56), it could lead to ugly extra fields with null values or a string of flags. Plus, this creates two queries (a JOIN might not always work if the application needs to run some logic to decide which image to pull).
Any advice is appreciated! I may just be overthinking this, but I want to get it right before the whole site is built around it!
Thanks,
Dave