my images are stored in MongoDB, I'd like to return them to the client, here is how the code is like:
@app.route("/images/<int:pid>.jpg") def getImage(pid): # get image binary from MongoDB, which is bson.Binary type return image_binary
However, it seems that I can't return binary directly in Flask?
Here is what I came up with now:
- return the base64 of the image binary. -> IE<8 doesn't support this.
- create a temp file then return it with
Is there better solutions ?