如何在Facebook上检测默认头像? [英] How to detect default avatar on facebook?

查看:593
本文介绍了如何在Facebook上检测默认头像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在链接上检测默认头像: https://graph.facebook.com/'.$id.'/picture?type=large
这是从特殊准备的配置文件中获取化身(男/女)的唯一方法,然后通过例如md5()?



很难相信这是唯一的方法。

解决方案>

您可以使用 redirect = false 参数:



https://graph.facebook.com/naitik/picture?redirect=false



然后,Facebook的回复是 json 并包含以下数据:

  {
data:{
url:https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/157337_5526183_369516251_q.jpg,
is_silhouette: false
}
}

您可以使用 is_silhouette 选项来检测照片是否为默认照片。



您可以在以下位置阅读更多信息:How to detect default avatar on the link like this: https://graph.facebook.com/'.$id.'/picture?type=large? Is it the only way to get avatars (male/female) from special prepared profiles and then compare by e.g. md5() ?

It's hard to believe this is the only way.

解决方案

You can use the redirect=false parameter:

https://graph.facebook.com/naitik/picture?redirect=false

Then facebook's responce is json and contains this data:

{
   "data": {
      "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/157337_5526183_369516251_q.jpg",
      "is_silhouette": false
   }
}

You can use the is_silhouette option to detect if the photo is default one.

You can read more at: https://developers.facebook.com/docs/reference/api/using-pictures/

这篇关于如何在Facebook上检测默认头像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆