I have this problem in regards with default开发者_JAVA技巧, since I m not sure whether i should store the path and dimensions of the image in code or in the db in some table.
I have 4 images each for a status free,reserved,booked,selected. I have table for the proper images with fields imgid, statusid, filename, imageheight, imagewidth.
But i m not sure what to do with default since just in case something happens and the images that are on the site are missing the website should still show something thus i came up with the idea of default images.
What if the database isn't available?
I think you should probably first look at the failure modes and see what images need to be available, and how the content is determined depending upon the severity of the failure. Some failures might be user-induced/configuration, others might be transient or system-wide.
Ultimately, it's possible that the page or site still needs to have hardcoded fallback default content.
Never put the path in the DB, or if you do, use a separate field. If it ever needs to change at least you can fix it in the code and not re-write all your data.
精彩评论