Is there a way to know if a user uploaded an image to the profile or it has the default user picture of Facebook via FQL or somthing else?
If a user doesn't have a photo then the is_silhouette field will be true when you request the user object with the "photo" field specified.
Example request:
https://graph.facebook.com/username?fields=picture
Response:
{
"id": "100002095576350",
"picture": {
"data": {
"url": "http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif",
"is_silhouette": true
}
}
}
Quick, dirty PHP function:
function facebook_user_has_photo($username_or_id){
$request = file_get_contents('https://graph.facebook.com/'.$username_or_id.'?fields=picture');
if($request):
$user = json_decode($request);
if($user && !$user->picture->data->is_silhouette) return true;
endif;
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With