I cannot figure a way get friends only with profile photos. I could use multi-query to check whether every friend has a photo, but that would incur heavy traffic.
Are there any alternatives?
I cannot figure a way get friends only with profile photos. I could use multi-query to check whether every friend has a photo, but that would incur heavy traffic.
Are there any alternatives?
Although Gajus’ suggested query might work right now, it’ll break once Facebook changes the URL of the default picture on their CDN. (Might happen, might not happen.)
So I’d suggest this for improvement:
The profile_pic
table has a field called is_silhouette
, which is a boolean for whether the user has their own profile picture set or not.
So to get only those of your friends, that have a profile picture set, you can use
SELECT uid, name FROM user WHERE uid IN
(SELECT id FROM profile_pic WHERE
id IN (SELECT uid1 FROM friend WHERE uid2 = me() )
AND NOT is_silhouette
)
–> Try this query in the Graph API Explorer.
This can be achieved with a simple FQL.
SELECT uid, name, pic_small FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND pic_small != 'https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/yP/r/FdhqUFlRalU.jpg'
The seb-query will get all yours friend uids
. The other query will match does uids with the profile data check if the pic_small
is referring to what Facebook uses as a placeholder.
You can quickly test it here.