Reputation: 28770
I want to serve a tracking image in an email.
The email will call a sinatra route which will return the image.
In rails, I would do this:
send_data Base64.decode64("R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="), type: "image/gif", disposition: "inline"
How would I do this in sinatra?
Upvotes: 2
Views: 622
Reputation: 15171
get '/route' do
content_type 'image/gif'
Base64.decode64("R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
end
If you want to set the disposition, you can do it like this (for example):
headers 'Content-Disposition' => 'inline;filename="tracking.gif"'
or
attachment 'tracking.gif', 'inline'
Upvotes: 5