Skip to content

Instantly share code, notes, and snippets.

@CoryFoy
Created September 16, 2014 17:21
Show Gist options
  • Select an option

  • Save CoryFoy/f2307cd08937537b4f8d to your computer and use it in GitHub Desktop.

Select an option

Save CoryFoy/f2307cd08937537b4f8d to your computer and use it in GitHub Desktop.
# This assumes you have a folder structure like the following:
# - App
# - myapp.rb
# - secure
# - foo.jpg
require 'sinatra'
get '/' do
'Hello, World! <img src="/image/foo.jpg" />'
end
get '/image/:img' do
send_file File.join('secure', params[:img]), :type => 'image/jpeg', :disposition => 'inline'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment