开发者

Should default Images be stored in code or db

开发者 https://www.devze.com 2023-03-24 01:31 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消