7

I am trying to get the photos a user is tagged in. I am using the query:

SELECT pid 
FROM photo 
WHERE pid 
IN (SELECT pid FROM photo_tag WHERE subject=me())

The number of results I get is 32. However when I run this query:

SELECT pid FROM photo_tag WHERE subject=me()

The number of results I get is 67. This is the number I expect because I am tagged in 67 pictures, not just 32. What am I doing wrong with the query?

3 Answers3

1

photo_tag table contains photos in which your are tagged, photo table contains photo uploaded by you

In your situation, you are tagged in 67 photos, and 32 out of 67 photos are uploaded by you, the others are uploaded by someone else (and you're tagged).

Hieu Vo
  • 3,105
  • 30
  • 31
1

It's possible that you're tagged in photos that are not accessible using the current access_token. Take one of the photo ids from the larger list that you don't see on the smaller list and try accessing it using that access_token.

DMCS
  • 31,720
  • 14
  • 71
  • 104
  • Hi! I used one of the photo ids and tried to get the information in my ios app and got empty string as result (Not even an error). Is there a way to test FQL queries outside of my app? – Malolan Santhanakrishnan Jan 05 '12 at 23:39
  • Actually I used the test console and tried a query "SELECT src FROM photo WHERE object_id = workingid" and I got the result, while when I tried it with the id that doesn't work, I got the empty [] string. – Malolan Santhanakrishnan Jan 05 '12 at 23:49
  • yes, use the graph API Explorer tool: https://developers.facebook.com/tools/explorer `/fql?q=` – DMCS Jan 06 '12 at 00:15
  • Yup tried it and I gave all the permissions possible to theExplorer app. Still I get empty "data" when I tried to query information using the bad id. How is that I am able to get tag information but not the photo information? – Malolan Santhanakrishnan Jan 06 '12 at 01:13
  • Ok, so then your access token is not able to "see" that photo. So that photo belongs to someone else other that the user your access token is assigned to. – DMCS Jan 06 '12 at 02:55
  • Hi, Thanks for the patient response. The photo belongs to my friend and I am tagged in that picture. I have friend_photos permission and I should be able to see it right in my app right? – Malolan Santhanakrishnan Jan 06 '12 at 04:08
  • Depends upon the specific permissions on the photo, but generally, yes you should get it. Check with your friend to see if they can play around with the security of that photo until you can/cannot get it. If you can never get it, then log this issue as a bug with Facebook. – DMCS Jan 06 '12 at 06:07
0

I have the same problem. Ownership of the photo does not seem to be the issue. I am able to see some pids (in the outer query) that are owned by my friends.

I run the inner query to get all the pids in which I am a 'subject'. When I try retrieving the details (pid, object_id, subject etc.) for some of these pids , I get an empty string. I don't think it is a permission issue. I have both "user_photos" and "friend_photos" enabled and am using the correct access token.

I tried examining what was different about these few stubborn photos. Some common themes: 1)uploaded from a mobile device 2)Shared with a "Custom" list of friends

But I haven't been able to root cause it yet.

  • Have you tried getting the object_ids corresponding to those pids and fetching them through the GraphAPI explorer as such (https://graph.facebook.com/object_id). The only thing that gets returned to me is "False" – Arpan Ghosh Jan 06 '12 at 04:50
  • Just saw this [link](http://stackoverflow.com/questions/7544904/facebook-fql-photo-tag-table-not-returning-all-appropriate-photos). While you may have "user_photos" and "friend_photos" permissions enabled, some fb users may choose not to share any of their photos, posts etc. with applications using the Facebook Graph API. You will be able to see photos (in which you are tagged) posted by such users on ur profile, but ur app will not be able to access them using the API. Thats probably it. – Arpan Ghosh Jan 06 '12 at 05:06