Get Facebook real profile image URL

后端 未结 5 1655
-上瘾入骨i
-上瘾入骨i 2020-12-08 17:40

According to Facebook graph API we can request a user profile picture with this (example):

https://graph.facebook.com/1489686594/picture

We don\'t need any T

5条回答
  •  醉酒成梦
    2020-12-08 18:11

    Please note that the The Surrican's answer (and possibly others) can drastically increase your script's response time (around +500ms for me on my server). This is because the server issues a request to facebook (because of get_headers()) and the execution time (computation excluded) extends from this:

    • browser -> server
    • server -> browser

    to this:

    • browser -> server
    • server -> facebook (request: get_headers)
    • facebook -> server (response: get_headers)
    • server -> browser

    This adds the mentioned 500ms delay. You probably should consider to cache the real url on your server or to load the profile picture via JavaScript. At least take a look at your response time before and after ;)

提交回复
热议问题