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


我正在开发离子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);
    });
});

}

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

picture.width(600).height(600).as(picture_small),picture.width(360).height(360).as(picture_large)', [])

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


13017
2018-03-07 05:47


起源

质量:100,你试过用这个吗? - devanshsadhotra
你什么意思?在哪里写它而不是什么? - Adir Zoari
请原谅!我的错 !!这个“质量”在上传图片时有效 - devanshsadhotra


答案:


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

profileData.picture="https://graph.facebook.com/"+profileData.id+"/picture?width=1024&height=1024";

9
2018-03-15 18:20



谢谢。这很有效。 - Hussnain Cheema


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

id,name,email,first_name,last_name,picture.type(large)

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


5
2018-03-15 05:29