How to detect default avatar on facebook?

前端 未结 4 795
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 07:17

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) fr

4条回答
  •  日久生厌
    2021-01-14 07:54

    There isn't an API you can call to tell if they are using the default photo or not. Instead of downloading the whole image and checking the MD5, you could issue an HTTP HEAD request to that profile URL and look at the Location header and see if the URL is one of the known default profile images:

    Male: https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v2/yL/r/HsTZSDw4avx.gif https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v2/yL/r/HsTZSDw4avx.gif

    Female (Darth Vader):https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v2/yp/r/yDnr5YfbJCH.gif

    enter image description here

    These URL's could change I suppose, and so could the default photos, but I haven't seen either case happen that I can remember.

提交回复
热议问题