开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜