Facebook API Question: Access of Friend Photos?

By Steve Poland   •   April 25, 2008

If anyone has experience with the Facebook API — I’m curious about two calls (maybe more): friends.get and photos.get [and possibly photos.getAlbums].

What I’m trying to do is have a logged-in FB user, in my FB app, be able to browse photos uploaded by friends [not necessarily with themselves in those photos — but just to see photos by their friends]. Is this possible?

My other question is whether it’s possible to grab comments on photos, for display in my app.

Thanks for any help!

Comments

3 Responses to “Facebook API Question: Access of Friend Photos?”

  1. MyAvatars 0.2 John on April 25th, 2008 11:02 am (perm link)

    I like to use direct fql queries myself, then you can say the exact data you want back. To get the photos you’ll probably want to do two calls, one to get the albums for that user and then do a call to get the photos for that album when they drill down.

    “select aid, cover_pid from album where owner = FACEBOOK_ID”
    gets the albums

    “select pid, link, src from photo where aid = ALBUM_ID”
    gets the photos for an album

    you can probably turn these into a single query if you’d like as well, depending on the api wrapper you’re using there might be an easier way to do this as well.

    As to your second question, as far as I know you can’t get the comments for a photo, you can only get the caption the owner has added.

    Hope that helps!

  2. MyAvatars 0.2 Steve Poland on April 25th, 2008 11:20 am (perm link)

    @John - thx; so with those queries I could ‘get friends’ of a userID, then use that query to grab the photos for each of those friends’ userIDs?

    And I’m so far removed from SQL, but I could specify all those userIDs in that single SQL query, right?

  3. MyAvatars 0.2 John on April 25th, 2008 12:08 pm (perm link)

    ya, that’s right

    “select aid, cover_pid from album where owner in (friend_id_1, friend_id_2,friend_id_2)”

    gets all the albums for those friends. are you going to show all the albums on one big page? I would probably use the facebook friend selector to let the user the friend, it refreshes the page with the albums for that friend which the user can drill into to see the photos in that album.

    What you you building your app in, php, ruby java? There are probably some easier ways to do this depending on the api wrapper you’re using.

Got something to say?





*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image