Reputation: 89
I am trying to retrieve each photo album from facebook by using php. I have user_photos and friends_photos permission. I manage to retrieve all albums and their photos but I cannot retrieve any photos that are tagged by friends.
I am quite new to facebook apps. Can anyone tell me how do I retrieve all the tagged photos?
Thanks a lot.
Upvotes: 0
Views: 236
Reputation: 17710
Your best solution is probably fql.
SELECT pid FROM photo_tag WHERE subject=$uid
will give you a list of photos where the tag is of a person. So you need to say "give me the people" then "give me the photos they are tagged in" and then "give me the albums (if you have permissions). Now you could to that in one query using the multi-query option (http://developers.facebook.com/docs/reference/fql/)
Easiest way of running FLQ is using the facebook PHP SDK:
$result = $facebook->api(array(
'query' => "SELECT pid FROM photo_tag WHERE subject=$uid",
'method' => 'fql.query'));
But you can also run using graph
'https://api.facebook.com/method/fql.query?query=' . urlencode("SELECT pid FROM photo_tag WHERE subject=$uid") (remembering to add the other parameters)
Upvotes: 1