omzmarlon / ManagementApp

0 stars 0 forks source link

Issue14 2/add image table #22

Closed tomyang729 closed 7 years ago

tomyang729 commented 7 years ago

After some research, I think we should use file system to store images and only store the file path in db, instead of directly storing binary in db. The reasons are 1. read/write large blob from db is extremely slow and heavy. 2. Using file system is the current standard for storing images and it's recommended. This is the change accordingly.

For how to use file system, the current solution is to store them locally on our own computer (before we have a storage server). Each time we store a new image, we need to firstly store a new row into the images table; then use the id as the filename and store it to the file system (a directory in our computer. We can set a common PATH variable in our environment, and use that variable to set the destination path). After it's saved, we can read it by using the file path that stored in db.

I can work on this query part later

Reference: https://softwareengineering.stackexchange.com/questions/164905/how-best-to-store-images-on-a-file-system http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay

omzmarlon commented 7 years ago

Good work. For public images, we can open another public static folder just like the web folder. For private images we may need some authentication on it. But for our current project, I think it's good enough to treat all images as public since we are just storing profile images

omzmarlon commented 7 years ago

Great job! I think it would still be nice if we could have a db structure graph on our google site. It would be more illustrative than looking at code sometimes

tomyang729 commented 7 years ago

Sure. My current one is really messy and hard to read now. I'll upload a clear one on Wednesday