2011-02-10 6 views
3

PHP를 사용하여 페이스 북 사진에 태그를 추가하는 방법은 무엇입니까?facebook photos_add 태그 방법이 작동하지 않습니다

이 코드는 $pid이며 사진의 ID는 $userId입니다. 내 facebook id입니다. 난>

$facebook = new Facebook($appapikey, $appsecret); 
$user_id = $facebook->require_login(); 
$test = $facebook->api_client->photos_addTag ($pid,$user_id, "text", 50.0, 50.0, '', $user_id); 

$test 반환 한

하지만 사진은 누군가가 내가 뭘 잘못 나를 쓸 수

태그되지 전에 이것을 사용이

있는지?

+3

당신이 기존의 SDK를 사용하고 있는지 알고 있어요,하지만 어떻게 ** 새로운 PHP-SDK를 사용하여 AND ** 새로운 그래프 API와 단지 내'photos.addTag'을 이전 나머지 사용에 대한 새로운 SDK – ifaour

답변

0
// tag photo parameter 
    $pid = $uid.'_'.$pid; // pid is the photo id, after it uploaded, you need to add the owner id(uid) in front of it, and the real pid is inside the 'link' of the photo's returned json. 
    //tag_uid = $uid; 
    //x = percentage of x position 
    //y = percentage of y position 
    $access_token = $session['access_token']; 

    $tag0 = array('tag_uid'=>$fd0,'x'=>'30.0','y'=>'85.0'); 
    $tag1 = array('tag_uid'=>$fd1,'x'=>'35.0','y'=>'85.0'); 
    $tag2 = array('tag_uid'=>$fd2,'x'=>'40.0','y'=>'85.0'); 
    $tag3 = array('tag_uid'=>$fd3,'x'=>'45.0','y'=>'85.0'); 
    $tag4 = array('tag_uid'=>$fd4,'x'=>'55.0','y'=>'85.0'); 
    $tag5 = array('tag_uid'=>$fd5,'x'=>'60.0','y'=>'85.0'); 
    $tag6 = array('tag_uid'=>$fd6,'x'=>'65.0','y'=>'85.0'); 
    $tag7 = array('tag_uid'=>$fd7,'x'=>'70.0','y'=>'85.0'); 

    $tags = array($tag0,$tag1,$tag2,$tag3,$tag4,$tag5,$tag6,$tag7); 
    $facebook->api(array('method'=>'photos.addTag','pid'=>$pid,'tags'=>json_encode($tags))); 

그러나 새로운 페이스 북 정책에서는 더 이상 사진에있는 사람을 자동 태그 지정하는 앱을 선호하지 않는 것으로 보입니다.

http://developers.facebook.com/docs/guides/policy/examples_and_explanations/photos/

관련 문제