My REST app has fleximage working (at least I think so) by storing the images in the database. Through cocoamysl, I can see the images in the database but I have no idea how to display them in my ''show'' view. In the fleximage tutorial it says to use this code in the views: <%= image_tag url_for(:controller => ''products'', :action => ''show'', :id => 5) %> When I do that and check the source code, this is what is displayed: <img alt="5" src="/students/5.png" /> Anyone know how to get images to display from the DB in a REST app using FlexImage? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Justin Ko wrote:> My REST app has fleximage working (at least I think so) by storing the > images in the database. Through cocoamysl, I can see the images in the > database but I have no idea how to display them in my ''show'' view. In > the fleximage tutorial it says to use this code in the views: > > <%= image_tag url_for(:controller => ''products'', > :action => ''show'', > :id => 5) %> > > When I do that and check the source code, this is what is displayed: > > <img alt="5" src="/students/5.png" /> > > Anyone know how to get images to display from the DB in a REST app using > FlexImage?You need to create an action that renders the image. In your controller: class MyController < ApplicationController def image @image = MyImage.find(1) render_flex_image(@image) end end Then try: <img src="<%= url_for(:action => ''image'', :id => 123) %>" /> Turns out the image_tag helper will append an extension of .png to your url if it has no extension. So unless you have a custom route with a file extension in it, image_tag will be problematic. I should fix that in the docs. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It works! Thank You Very Much! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---