I understand Mongodb can store images in two ways.
- in a regular document by storing the image as binary
- via Gridfs for managing larger images.
For simplicity and because the images I plan to server are small, I will go for option 1.
To serve the images to a browser I am using nodejs.
My question is how difficult will this be? How do you turn binary data to an actual image a browser will understand? What type of encoding is involved?
Could you point me to tutorials/examples elsewhere on the web?
By the way I know this may not be good idea for performance reasons, I plan to cache the images once served. I just want to avoid the file-system all-together.