2012-01-01 79 views
0

我使代码工作!但这是一个小问题。张贴在墙上的图像非常小。 代码上传照片在相册中,然后发布信息到墙上。但贴在墙上的图片太小了。当您打开一个图库时,打开已创建的相册,然后点击分享照片并选择墙壁,然后在墙上出现BIG PHOTO。那么,如何使用PHP SDK在墙上张贴BIG照片?请帮帮我。我正在学习明天的测试,请为我修改代码。我没有太多时间。张贴在专辑的墙上照片,但更大

function publish($text, $data,$image1,$file1) // publikuje na Tablicy 
{ 
$facebook = new Facebook(array(
'appId' => '225192487556449', 
    'secret' => '8546fb31fa6f00aa2068b04b65544353', 
'access_token' => $data['token'] 
)); 

$message = 'Check out that!'; 


$attachment = array(
     'access_token' => $access_token, 
     'message' => $text, 
     'name' => "", 
     'link' => "@".$file1, 
     'description' => "Tak może wyglądać mój nagrobek :(", 
     'picture'=> $image1, 
     ); 

$facebook->setFileUploadSupport('http://www.szymad.pl/facebook'); 
     $response = $facebook->api(
      '/me/photos/', 
      'post', 
      array(
      'message' => $text, 
      'source' => '@'.$file1 // @-sign must be the first character 
     ) 
     ); 




$wynik = $facebook->api('/me/feed', 'POST', $attachment); 
//$wynik = json_decode($wynik); 
if($wynik['error']) 
echo $wynik['error']['type'].': '.$wynik['error']['message']; 
else 
echo "<br />Wpis został opublikowany!"; 
} 
+0

尝试上传下的长城照片相册照片。解释[这里] [1] [1]:http://stackoverflow.com/questions/8424013/how-to-include-on-the-wall-a-photo-post-though-graph -API – 2012-01-02 10:57:39

回答

1
$facebook->setFileUploadSupport(true); 
     $response = $facebook->api(
      '/me/photos/', 
      'post', 
      array(
      'message' => $text, 
      'source' => '@'.realpath($file1) // @-sign must be the first character 
     ) 
     );