简体   繁体   English

无法加载Facebook Graph API个人资料图片网址

[英]Failed to load Facebook Graph API profile picture URL

So this code was working fine for me before: 因此,此代码之前对我来说运行良好:

    FB.api("/me/picture?width=600&height=600", function(profile_picture)
    {
            user_me_picture = profile_picture.data.url;
    }

But after Facebook Dev update, the url parameter can't be loaded, it's because of new Facebook link on the Graph API: 但是在Facebook Dev更新后,无法加载url参数,这是由于Graph API上的新Facebook链接:

{
  "data": {
    "height": 50,
    "is_silhouette": false,
    "url": "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=1633647180278779&height=50&width=50&ext=1531277613&hash=AeTrVjn5tUK7zxEo",
    "width": 50
  }
}

Is there anyway I can fix my code with this new Facebook profile picture url? 无论如何,我可以使用此新的Facebook个人资料图片网址修复代码吗?

Thank you! 谢谢!

I know it's probably late, but this happened to me recently without a warning. 我知道可能已经晚了,但是最近这件事发生在我身上,没有任何警告。 Suddenly, my app stopped to load the user's profile picture. 突然,我的应用停止了加载用户的个人资料图片。

After research a bit, i found out that, from now on, you need to call to the Facebook's API directly to download it. 经过一番研究,我发现从现在开始,您需要直接调用Facebook的API进行下载。

Check this answers if you want to figure out of the "why of this" and how to fix it in depth, but in short, just add the Facebook's user id into the URI of the API like this: 如果您想弄清楚“这是为什么”以及如何进行深入修复,请查看此答案 ,但是总之,只需将Facebook的用户ID添加到API的URI中,如下所示:

https://graph.facebook.com/{userId}/picture where userId is the one returned by Facebook in the same API call. https://graph.facebook.com/{userId}/picture ,其中userId是Facebook在同一API调用中返回的那个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM