有没有办法使用graph api更改用户的个人资料图片?
我知道你不能使用其余的 api (参考 https://stackoverflow.com/questions/2995397/set-or-update-profile-picture-using-fbconnect-facebook),但我在新的图形 API 中找不到任何内容。
使用 Graph API 将图片上传到现有相册(或创建新相册)。
看起来像这样:
$args = array('message' => 'Caption');
$args['image'] = '@' . realpath("the_image.png");
try {
$data = $facebook->api('/'.$album_uid.'/photos', 'post', $args);
}
catch(Exception $e) {
print "<pre>";
print_r($e);
print "</pre>";
}
然后通过Graph API获取上传的图片并重定向到图片的链接,添加&makeprofile=1
到查询字符串。用户现在将被重定向到个人资料图像裁剪页面:
try {
$pictue = $facebook->api('/'.$data['id']);
header("Location: ".$pictue['link']."&makeprofile=1");
}
catch(Exception $e) {
print "<pre>";
print_r($e);
print "</pre>";
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)