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? Also would it just be better for me to make the image, cache it, then use send_file to it instead of send_data? -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 3, 8:21 pm, Mohammad El-abid <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yes I am on Windows, haven''t felt a need to get onto Ubuntu yet. So I was able to get it working now! Can anyone recommend libraries for pasting together multipliable images? e.g. I have body, arms, legs, etc images and want to put them all ontop of each other. I do not believe that I need to move them. (I''ve heard rMagick but it''s not too windows friendly, hoping to find something else that''s pure ruby) -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.