Amit Hagin
Amit Hagin

Reputation: 3236

Facebook Graph - getting my pictures

I'm looking for the fastest way to get all the pictures I'm tagged in with someone specific.

As for now I need to check "my photos" then "the other someone's photos" and then photos in albums of all my friends.

it takes forever.

I need a way (I guess it's an FQL request) to get all the photos me and a specific friend are tagged in together?

Upvotes: 1

Views: 165

Answers (1)

cpilko
cpilko

Reputation: 11852

Getting some of the photos easy to do with an FQL Query:

SELECT object_id, src, owner, caption, created 
     FROM photo 
     WHERE object_id IN (SELECT object_id FROM photo_tag WHERE subject = me())
       AND object_id IN (SELECT object_id FROM photo_tag WHERE subject = 'MY_FRIENDS_ID')

(In this example MY_FRIENDS_ID could also be an event id or a group id)

Facebook has limits on the number of objects returned by an FQL query. To get all of the items, you'll have to write a script that appends AND created < {OLDEST_DATE_RETURNED_BY_LAST_QUERY} to your FQL and repeats the query until no data is returned.

Demo query here of photos you are tagged in: https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20object_id%2C%20src%2C%20owner%2C%20caption%2C%20created%20FROM%20photo%20WHERE%20object_id%20IN%20(SELECT%20object_id%20FROM%20photo_tag%20WHERE%20subject%20%3D%20me())

Upvotes: 3

Related Questions