Folks, I am in middle of writing a web application (Python/Flask) where home page has user profile image in the navbar which is coming from a database (blob), I am wondering if this is a good practice. Here I have following choices:
- Currently it is stored image in the backend db in a table in a blob
field. - Store the image disk location in the table instead of storing the image itself in the blob field, this will refer to the disk file
where to load the image from instead of transferring the image file
from a blob field. - Avoid hitting the db altogether when accessing the images and use a local disk file location instead, this location can be mapped to
nginx directly which means web caching will ensure fast image
retrieval.
Wondering if this is a big issue and how you guys are handing it anyway, what is the industry best practices here? Please note the database will be hit anyway to load various other items like user first_name and possibly other bits too but I don’t want to lose the choice of storing images which can be cached.
Any help here will be highly apprecaited.
New contributor