I have successfully uploaded a photo to user's album using following code
$data = [
'message' => 'My awesome photo upload example.',
'source' => $fb->fileToUpload($merged_picture_path),
];
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post('/me/photos', $data, $accessToken);
//print_r($response);
// echo "Posted with id: " . $response->getProperty('id');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
Now I want to retrieve the link to this image.For that I retrieved the id of this photo
$graphNode = $response->getGraphNode();
$photo_id=$graphNode->getProperty('id');
Using this id I try to get the link to this image as follow.
try {
$pictue = $fb->get('/'.$photo_id);
print_r($pictue);
header("Location: ".$pictue->getProperty('link')."&makeprofile=1");
}
But I am unable to receive the link since $fb->get('/'.$photo_id); does not return this link.
Please tell me how to get this link to the uploaded image using its id