Rendering an image

后端 未结 2 1148
长情又很酷
长情又很酷 2020-12-24 06:58

So this should be pretty easy, yet I can\'t get it work.

I have a controller method that finds an image based on a query, then the output gets cached. The image coul

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-24 07:39

    What version of Rails? For Rails 3, you should look at the streaming methods that were added. send_data would be the proper way of sending binary data. If the images are local, and your web server supports it, you can use send_file which won't block a rails instance while the user downloads an image.

提交回复
热议问题