brendon-boldt/imago-imaginis

Do we even need paths stored in the database?

Closed this issue · 4 comments

If we have a consistent way of storing files in the system, do we even need to store file paths in the database?

Wouldn't the web server still need the file paths to access these photos?

Right now, you can find the file if you know the file system configuration as well as the ID of the photo you are trying to retrieve.

this.profilePhoto = this.db.url + "/" + res.json()[0].path;

I display photo with this. If we removed file paths, I would have to hard code the right path e.g.
this.db.url + this.route + res.json()[0].path <------ just the file name, which would just be photo id, and where this.route is "/../../files/images/uploads/".
So for whatever reason if stuff changes on the backend, stuff will break. But hardcoding it in isn't too bad of a change to put in. Or could even get the proper route from a separate table in the database, but could make things more complicated

Okay; that seems like a good reason to store paths.