Tag friends in photo using graph api
-
28-10-2019 - |
题
I want to tag user's friends into the photo which is uploaded by user from my application....anyone please help me in that...i will be very thank full....i m using codeigniter as a framework.... i already created an photo album in user's profile and uploaded that photo into that but now i want to tag his friends fetched from his friend list...
this is the code i used for creating the album and uploading the photo =>
$fb_config = array(
'appId' => '148056051963323',
'secret' => '0cebf087b3084e5a772b6c31acb2736a'
);
$this->load->library('facebook', $fb_config);
$this->facebook->setFileUploadSupport(true);
$album_details = array(
'message'=> 'For more LoL images check out -> http://lolsharing.com/',
'name'=> 'LoL Sharing'
);
$album_exist_check = $this->common_model->check_album($_SESSION['user_fb_id']);
if($album_exist_check['album_id']==0)
{
$create_album = $this->facebook->api('/me/albums', 'post', $album_details);
$insert_ablum = $this->common_model->insert_ablum($_SESSION['user_fb_id'], $create_album['id']);
}
else
{
$create_album['id'] = $album_exist_check['album_id'];
}
$photo_details = array(
'message'=> ''.$image_name['image_caption'].' for more LoL Images check out - http://lolsharing.com/'
);
$photo_details['image'] = '@' . realpath(''.FCPATH.'assets/joke_images/'.$image_name['image_name'].'');
$upload_photo = $this->facebook->api('/'.$create_album['id'].'/photos', 'post', $photo_details);
if($upload_photo)
{
$this->common_model->user_point_counter($image_id);
$this->common_model->user_self_point_counter();
if($upload_photo)
{
//redirect(''.$_SESSION['return_url'].'');
echo "<div class='button1'>Image Shared.</div>";
echo '<div class="num_share">
Total Shares <br />
<span> '.$image_name['shares'].'</span>
</div>';
}
}
please help me..thanks in advance
解决方案
Here's how to add tags. The example I'm giving is using the Graph API Explorer: https://developers.facebook.com/tools/explorer
See also the tags
section of: https://developers.facebook.com/docs/reference/api/photo/
- request a token with the appropriate permissions (see above link for the permission you will need)
- Enter in your photo ID and click Get
- Add /tags to the graph url and click Get to see what tags already exist
- Change Get To Post in the dropdown
- Click Add a field, Name= to, Value= a friends id or your id
- Click Add a field, Name = x, value = 45
- Click Add a field, Name = y, value = 45
- Click Submit
- Change Post back to Get in the dropdown
- Click Submit to see the new tag
- Of course the person you're tagging in the photo might need to approve the tag if they have their security features set as such.
不隶属于 StackOverflow