使用cordova插件获得高质量的facebook个人资料图片

Adi*_*ari 11 facebook facebook-graph-api ionic-framework ionic2

我正在开发离子2应用程序.我正在尝试获得高质量的图像,然后将其调整为头像照片.

我的代码:

 _FBUserProfile() {

return new Promise((resolve, reject) => {
  Facebook.api('me?fields=id,name,email,first_name,last_name,picture.width(600).height(600).as(picture_small),picture.width(360).height(360).as(picture_large)', [])
    .then((profileData) => {
      console.log(JSON.stringify(profileData));
      return resolve(profileData);
    }, (err) => {
      console.log(JSON.stringify(err));
      return reject(err);
    });
});
Run Code Online (Sandbox Code Playgroud)

}

但是,照片质量不好,因为我觉得我在这行调整大小时出了问题:

picture.width(600).height(600).as(picture_small),picture.width(360).height(360).as(picture_large)', [])
Run Code Online (Sandbox Code Playgroud)

如何才能获得高质量的照片?

Raj*_*rma 10

如果您想获取用户的公开个人资料照片,并且您知道来自api呼叫的用户ID,请使用此网址获取图片

profileData.picture="https://graph.facebook.com/"+profileData.id+"/picture?width=1024&height=1024";
Run Code Online (Sandbox Code Playgroud)


Edd*_*ove 6

你有几个解决方案,比如使用 type large

id,name,email,first_name,last_name,picture.type(large)
Run Code Online (Sandbox Code Playgroud)

如下所述:https://developers.facebook.com/docs/graph-api/reference/user/picture/