Given a link to a facebook photo like this:
http://www.facebook.com/photo.php?pid=123&id=456
how can I get the internal facebook id for the photo? The "pid" in the link is not the "pid" in FQL in the "photo" table from what I've seen in my experimentation. The best I can think of is to read back all the user's photos using the userid (id=456) and look for a matching link URL but that is slow and clumsy. Is there a more direct approach?
Edit: this is the best I've been able to come up with, it works but it pulls a lot of data back if the user has many photos. It executes reasonably fas开发者_StackOverflow中文版t (1 second or so) so it's OK but I'd still like to know if there is a more direct approach:
SELECT link,object_id,aid FROM photo WHERE aid in (SELECT aid FROM album WHERE owner=456);
then search the results for a matching link with the "pid=123" substring
It turns out I also need the object id for the album and its size, so then I do a second query with the matching aid found from the first step:
SELECT object_id,size FROM album WHERE aid='<aidFromStep1>' AND owner=456;
not sure if it is what you want but if C# is the call then i have done this through following code
dynamic friends = app.Get("me/photos", parameters);
foreach (dynamic photoInfo in friends.data)
{
MessageBox.Show("Photo id is "+ photoInfo.id);
}
精彩评论