开发者

Why doesn't this FQL return profile pictures for some users?

This FQL is from an app which has been running for a few days now, and has been thoroughly tested:

SELECT src_big FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = {uid} AND type = 'profile')

I'm using the JS API bridged from开发者_如何学Go ActionScript and the {uid} part is replaced with whatever uid corresponds to a list item clicked in a friend browser. The thing is that most of the time this query works fine and nice, large images are returned (although usually not a complete set of matching profile images), but in some instances the query does not return anything at all, just an empty array. Checking the user's profile images album confirms that there are plenty of images to choose from. Anyone know why that might be?


Probably because that user has their privacy settings set so you cannot access their profile picture.


That's because some fields are visible to public and others need permissions, if you navigate to the users.getInfo method as advised from the user table. You'll find the list of public fields that you can query for any user:

  • uid
  • first_name
  • middle_name
  • last_name
  • name
  • locale
  • current_location
  • affiliations (regional type only)
  • pic_square
  • profile_url
  • sex

Now query the album table would most likely return nothing if the user didn't grant you permissions, but it's worth to try the following:

SELECT pic_big FROM user WHERE uid={uid}

If it didn't work then you may need to stick with pic_square from the list above.

Also it's worth to note that all the pic fields might be empty:

pic_big The URL to the largest-sized profile picture for the user being queried. The image can have a maximum width of 200px and a maximum height of 600px. This URL may be blank.

This applies to all the pics as mentioned in the user table.

IMPORTANT NOTE:
It's always a good practice to have a fallback image (a generic image) to use whenever no image is returned!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜