Jack W Jennings schrieb:> I''d like to display an image from the data submitted from a file
field
> before it''s written to the database, but I''m having a
hard time
> figuring it out. If I put the send_data function into crop, the image
> displays, but without the layout, but the way it''s set up below,
the
> data isn''t being passed to the temporary_photo display.
>
> Is there a better way to do this? Help!
>
> ## The controller
>
> def crop
> @photo = Photo.new( params[:photo] )
> end
>
> def temporary_photo
> @photo = Photo.new( params[:photo] )
> send_data(@photo.attachment_data,
> :filename => @photo.filename,
> :type => @photo.content_type,
> :disposition => "inline")
> end
>
> ## crop.rhtml
>
> <%= image_tag url_for( :action => :temporary_photo ) %>
Try this:
<img src="<%= url_for(:controller => "your_conroller",
:acion => "temporary_photo2,
:id => @photo_id %>" />
Works here.
--
Jochen Kaechelin
railswerk.de, gissmoh.de, figgfrosch.de, ror-ror.de
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---