[Facebooker-talk] rendering images from a file upload

Allen Walker auswalk at gmail.com
Tue Aug 26 00:48:24 EDT 2008


Actually I got most of the code from here: 
http://railsforum.com/viewtopic.php?id=4642

They explicitly use the image_tag which is ultimately calling a method 
in the controller.

In the fbml source when I hit the url it just fires up bunch of binary 
in the page . So it's finding the image blob but not rendering it correctly.

Ken Schroeder wrote:
> Is that path relative to RAILS_ROOT/public/images? Appears your trying 
> to use a controller path to access the images. I think image_tag 
> inherently uses RAILS_ROOT/public/images prepended to to the string, 
> unless a fully qualified URL is provided, which seems your trying to 
> use a relative path.
>
> On Mon, Aug 25, 2008 at 10:53 PM, Allen Walker <auswalk at gmail.com 
> <mailto:auswalk at gmail.com>> wrote:
>
>     Ok i've gotten the file upload working (I have users uploading
>     images basically to be viewed on another page) but not sure how to
>     display it on a facebook canvas. Do I need to present it in a iframe?
>
>     PhotosController:
>
>     def code_image
>       @image_data = Photo.find(params[:id])
>       @image = @image_data.binary_data
>       send_data(@image, :type => @image_data.content_type, :filename
>     => @image_data.filename, :disposition => 'inline')
>      end
>
>     show.fbml.erb:
>
>     <% for column in Photo.content_columns %>
>           <%= column.human_name %>
>           <% if column.name <http://column.name> == "binary_data" %>
>               <%= image_tag("/photos/code_image/#{@photo.id
>     <http://photo.id>}", :alt => "Image") %>
>           <% else %>
>               <%=h @photo.send(column.name <http://column.name>) %>
>           <% end %>
>       <% end %>
>
>     the URL i'm directly going to to view the image:
>
>     http://apps.new.facebook.com/myapp/photos/code_image/1
>
>
>     If I view the source html it shows a bunch of binary code of the
>     image in the fbml source
>     _______________________________________________
>     Facebooker-talk mailing list
>     Facebooker-talk at rubyforge.org <mailto:Facebooker-talk at rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/facebooker-talk
>
>



More information about the Facebooker-talk mailing list