Mau*_*sky 26 facebook facebook-graph-api
有没有办法使用图形api更改用户的个人资料图片?
我知道你不能用其余的api(参考),但我在新的图形api中找不到任何东西.
fre*_*rik 42
使用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>";
}
Run Code Online (Sandbox Code Playgroud)
然后通过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>";
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28905 次 |
| 最近记录: |