I want to save image into database one of my web application. I am using MEAN architecture for this. What is the best way to do this? Please help me out with some proper example, tutorial or guidance.
We started with Q&A. Technical documentation is next, and we need your help.
Whether you're a beginner or an experienced developer, you can contribute.
In MongoDB we cannot store data whose size is more than 16MB, whereas images can easily exceed the size based on the resolution of the image. Use GridFS to store images - GridFS is a specification for storing and retrieving files that exceed the BSON-document size limit of 16 MB. Instead of storing a file in a single document, GridFS divides the file into parts, or chunks 1, and stores each chunk as a separate document. By default, GridFS uses a chunk size of 255 kB; that is, GridFS divides a file into chunks of 255 kB with the exception of the last chunk. The last chunk is only as large as necessary. Sample Implementations for storing and retrieving images using GridFS NodeJS and GridFS http://mongodb.github.io/node-mongodb-native/api-articles/nodekoarticle2.html https://medium.com/@alvenw/how-to-store-images-to-mongodb-with-node-js-fb3905c37e6d#.268827v7s |
|||
|