PhotosDuplicateTagInBatch error when uploading / tagging photos in Facebook!
I am writing an application that allows users to upload multiple photos at once to facebook and it will automatically tag themselves (no one else) in the photo when this happens.
If I run the script once, it works fine, if I try to upload and tag multiple photos then it complains with a PhotosDuplicateTagInBatch
error and I can't find ANY information as to why this is happening!
Here is my code:
for ($i = 5; $i >= 1; $i--)
{
$img = GetImage($i);
$tag = array(
'tag_uid' => $facebook->getUser(),
'x' => rand (0,100),
'y' =开发者_JS百科> rand (0,100)
);
$tags[] = json_encode($tag);
$args = array(
'message' => $i,
'image' => '@'.realpath($img),
'tags' => $tags,
);
$data = $facebook->api('/me/photos', 'post', $args);
}
}
If I output my arguments they come out as: Code:
Array
(
[message] => 4
[image] => @imagepathhere
[tags] => Array
(
[0] => {"tag_uid":"100002493436028","x":13,"y":68}
[1] => {"tag_uid":"100002493436028","x":60,"y":57}
)
)
So essentially, from what I can tell, you cannot upload and tag multiple photos like this. What I had to do was upload the photo, then tag it separately and rinse and repeat
精彩评论