How to stream image object in Sinatra
I had uploaded images to 开发者_如何学运维mongoDB using GridFS. I want to retrieve an image from the db and display it in the browser. How to do this with the help of Sinatra and HAML.
This Sinatra app uses the old GridStore API, but the principle still applies. Create a separate URL for images, set the content type, and call #read on the Grid method:
http://github.com/banker/mongodb_examples/blob/master/tweets/sinatra_tweets.rb
精彩评论