if u want to use your app as api also then url i think is best
When to save URL images in a database vs when the file-system is enough
Hi,
What is the best way to manage images in the following situation…
I have a real simple CMS-like- app where images will be uploaded and stored in either the default storage or the public directory (not sure what is the best location) and then accessed in any part of the authenticated areas of the app. For instance the user will have the option to insert any of the uploaded images from/to any of the pages by inserting the URL of the selected image (using an inline HTML editor ).
-
Do I need to save the URLs of the images in a database or saving them in a directory and then just retrieving the file names directly from the directory would be enough?
-
Can someone describe a situation when It’s recommended to use a database and when to use the file system directly?
Thanks a lot
@fsdolphin I save just the filenames of uploaded files in my database. That way, I’m not tied to one particular storage mechanism. I can also move images between folders and change it one place, instead of having to upload multiple rows across many tables in a database.
Please or to participate in this conversation.