Search code examples
ruby-on-railsfacebookfacebook-graph-apikoala

Get large images from Page Feed? using Koala Gem & Rails 3.2


Does anyone know how to pull different size images from the Page Feed?

I was trying to use the Type hash that works great for friends and profile pictures.

@page-feed = @graph.get_connections("somepage", "feed", {"type" => "large"})

but for some reason I'm always getting the same picture size for all posts.

Thanks !


Solution

  • Just in case anyone else comes across this, this is what I had to do in order to retrieve the large images. Note that I'm only grabbing the first post in the feed.

    In my controller:

    @fb_post = @facebook.get_connections(page_id, 'posts').first
    @photo = @facebook.get_connections(@fb_post['id'], 'attachments').first
    

    Then, to grab the proper link in the view inside of an img tag, I used:

    @photo["media"]["image"]["src"]