Upload the picture to an existing album (or create a new one) using the Graph API.
Will look something like this:
$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>";
}
Then get the uploaded image via the Graph API and redirect to the image's link, add &makeprofile=1
to the querystring. The user will now be redirected to the profile image cropping page:
try {
$pictue = $facebook->api('/'.$data['id']);
header("Location: ".$pictue['link']."&makeprofile=1");
}
catch(Exception $e) {
print "<pre>";
print_r($e);
print "</pre>";
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…