2

我试图通过首先访问用户相册,通过 Koala gem 在我的 rails 3.12 应用程序上显示 facebook 相册照片。我知道如何获得专辑:

u.facebook.get_connections('me', 'albums') 

但没有直接访问个人相册的照片。相册对象中有一个指向 facebook 页面的链接,该页面显示所有相册照片,仅此而已。我需要能够通过图形 API 进一步深入了解以获取单个照片对象,但我不知道如何使用考拉这样做。我更喜欢基于考拉的解决方案,但我对任何解决方案都持开放态度。

谢谢...

4

3 回答 3

3

我可以使用以下方法深入了解并访问相册中的照片:

current_user.facebook.get_connections("me","albums", :fields => "name, photos.fields(source)")
于 2013-04-19T04:41:47.440 回答
2

First, you have to use the "user_photos" access_token. and then fetch the id of the album usign :

albums = u.facebook.get_connections('me', 'albums') 

then extract the album you want, and use the id of the album to fetch photos :

get_connections('#{album['id']}', 'photos')

I haven't tried it in ruby (I used the graph explorer), so tell me if it works :)

于 2013-04-16T14:15:09.357 回答
2

This just worked for me! @graph.get_connections(album['ALBUM_ID'], "photos"])

于 2013-11-05T00:49:06.183 回答