如何在Meteor应用程序中显示facebook好友数量+个人资料图片

How to display facebook number of friends + profile picture in Meteor app?

本文关键字:资料图片 好友 facebook Meteor 应用程序 显示      更新时间:2023-09-26

我有一个简单的Meteor应用程序,用户可以通过Facebook登录。登录后,默认情况下只显示两个内容:用户名和注销按钮。

如何在登录后呈现用户的facebook个人资料照片+用户的好友数量?

我知道我需要使用:

    {{#if currentUser}} {{/if}} 

但我真的不知道该在这些括号之间添加什么代码。

尝试添加:

    {{currentUser.services.facebook.avatar}} 

但它不起作用。我也尝试过类似的东西:

    <img src="https://graph.facebook.com/{{currentUser.services.facebook}}/picture?wudth=200&height=200">

老实说,我试图找到一个重复的问题,但真的做不到。请帮忙。

您应该在图像查找中使用facebook.id,如:

"https://graph.facebook.com/" + user.services.facebook.id + "/picture?width=200&height=200"

或在模板中:

<img src="https://graph.facebook.com/{{user.services.facebook.id}}/picture?width=200&height=200">