开发者

How to stream image object in Sinatra

开发者 https://www.devze.com 2022-12-26 18:28 出处:网络
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

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

精彩评论

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

关注公众号