简体   繁体   中英

Is it even possible to tag photos in Facebook?

I'm reading wildly different things about tagging photos on Facebook.

  1. One article says you can send tags=array(...tag_uid...) at the same time as you post the photo: Tagging photos on Facebook with Graph API / PHP SDK

  2. One article said you can tag, but first you have to post to photo, and then set tags afterwards. (Can't remember the page)

  3. One article said you can tag, but only one tag per request, so you have to iterate over the array. (Can't remember the page)

  4. One article says you can't tag at all: https://developers.facebook.com/blog/post/371/

Does anyone know if tagging actually possible, and what is the correct way of doing it as of the current date?

You must get Photo ID firs and then tag someone on this photo

  1. upload photo to album

    $photo_details = array( 'message' => $message, 'access_token' => $token );

    $photo_details['image'] = '@' . realpath($file);

    $uploaded_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);

  2. Get Photo ID

    $photo_id = $uploaded_photo['id'];

  3. set Friend ID you want to tag

    $tags = array( array('tag_uid' => $friend_id, 'x' => rand() % 100, 'y' => rand() % 100 ) );

  4. tag friend

    $facebook->api('/'.$photo_id.'/tags', 'post', array('tags'=>$tags));

It works for me, I hope this will help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM