If you want to get all photos from each album of any particular facebook user, then try the following code. I have used it and it works in my application. Hope that u can also enjoy it......
## Just initialize two arrays ##
@albums = []
@fbphotos = []
## Get the facebook user information who is logged in ##
@fbuser = fbsession.users_getInfo(:uids => fbsession.session_user_id, :fields => ["first_name", "last_name", "pic_big"])
## Then collect all album information providing his/her facebook user_id ##
@fbalbums = fbsession.photos_getAlbums(:uid => @fbuser.uid)
doc = Hpricot::XML(@fbalbums.to_s)
(doc/:album).each do |a|
aid = a.at('aid').innerHTML
@albums <<>
end
@albums.each do |a|
@fbphotos << uid =""> @fbuser.uid, :aid => a)
end
## Thus, finally you will get all the photos stored in @fbphotos from each album... If u want photos for any particular album, then not need to write entire code, just use fbsession.photos_get method with passing parameter :aid i.e album_id...
Can you pls tell me which all plugins or gems will required for implementing this feature? and If possible pls update post with complete example.
ReplyDeleteThanks,
Chetan