What would be most appropriate and a good practice to save images in database
By route or within the manager as data
What would be most appropriate and a good practice to save images in database
By route or within the manager as data
What is currently done is to save the path of the uploaded file and upload the file not even to the server but to a more specialized cloud service such as Amazon Web Store or simply AWS advantages of that, your server does not have to serve those static files that you upload so the load is freed besides those CDNs are specialized in serving static files have several replicas to throughout the world so it will usually have lower load times than if you upload it to your own server.
The following fragment was extracted from Phpcentral - Advantages and disadvantages of saving images in the database
The problems of storing in BD are:
Access time to the files: access to the filesystem is always faster than to a database (the db requires connection, authentication, authorization, etc.).
Increase in size of the database: if we must persist a large amount of files and / or few but large, this will cause our database to increase in size, and consequently its administration will be more complicated (slower backups and restores, blocking times of the larger data base).
In general almost always choose to use the filesystem to store them but there are different scenarios where it is more practical to store in database.