forthrin
forthrin

Reputation: 2777

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?

Upvotes: 2

Views: 135

Answers (1)

Zaza Sichinava
Zaza Sichinava

Reputation: 31

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

Upvotes: 1

Related Questions