LoginSignup
3
3

More than 5 years have passed since last update.

publicからアクセスできない場所にあるバイナリ画像を表示する

Last updated at Posted at 2014-09-16
def get_image(params)
  send_data(
    File.binread("/tmp/#{params[:tmp_filename]}"),
    filename: params[:filename],
    type: params[:type], # content-type
    disposition: "inline"
  )
end

こんな感じで、後はcontrolerに設定してアクセスする。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3