D
D
Denis Denis2016-02-15 20:40:40
MongoDB
Denis Denis, 2016-02-15 20:40:40

How to display an image received from mongo?

Hello!
Picking a meteor. From base I receive object of a picture. But how to display it?
If you need _id, of course, we take the _id property. Some other property - we take it. But how to show the whole picture?
Thanks :)
ps GRIDFS add-on is used

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2016-02-15
@riky

files should be stored in files, not in the database.
but since you got in trouble
for displaying, you have two ways either to insert it into the body of data base64
or to make a separate route ( /image/14578.jpg ) which, by id, will output the body of the image to the output (res.send(post.image)) to the output +
add "Content-Type: image/jpeg" to headers

U
un1t, 2016-02-15
@un1t

stackoverflow.com/questions/22401417/file-download...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question