I need to show an image thats loaded from a filesystem(-ish) resource
in view. But I can''t quite figure this one out.
send_data seems to take over the view (with :disposition =>
''inline'')
and I''m not quite sure how to set the content-type for the image alone
before sending it as an instance var to my view, so I can do <img
src="<%= @image_file -%>" /> and similar.
The method which reads the image resource is simply something like
this (and quite unrelated to rails really):
@root.file_contents(path) do |stream|
stream.read(@root.file_length(path))
end
I''ve tried various way of setting the @headers/@response.header, with
the only result being the entire reponse altered, not just the one for
image.
So, I haven''t found anything along the lines of a read_data() method,
anyone got one handy or just some general pointers?
Cheers,
johan-s
--
http://johansorensen.com
http://theexciter.com