How to retrieve image files from mongodb to html page

Viewed 3014

I have successfully stored image files in mongdb in binary format.but when i m getting image from mongodb i m getting the same banary format.But i need this image file.Please someone could help

This is the code i used

def retrieve(request):

  db=pymongo.connection.Connection('localhost',27017).demo1
  grid=gridfs.GridFS(db)
  output=grid.get_last_version(filename='shiva.jpg')
  return HttpResponse(output)
1 Answers
Related