On Nov 3, 8:21 pm, Mohammad El-abid <[email protected]> wrote:
> So this is the original code I used, and it worked
>
> send_file 'vendor/sprites/not-found.png', {:filename =>
> "sprite-not-found.png", :type => "image/png", :disposition => "inline"}
>
> Now I switched it to this (going to be adding imageMagick)
>
> send_data File.read('vendor/sprites/not-found.png'), {:filename =>
> "soldier-not-found.png", :type => "image/png", :disposition => "inline"}
>
> But now instead of seeing my image I see the good 'ol broken image. I
> assume this is because an image is binary but File.read() uses String.
> How would I go about loading an image into RAM and serve it?
>

a String in ruby is just a collection of bytes - there isn't a
separate binary type. If you're on windows you might need to open the
file in binary mode

Fred

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to