我制作有效的代码!但这是一个小问题。张贴在墙上的图片非常小。 代码正在上传相册中的照片,然后将信息发布到墙上。但贴在墙上的图像太小了。当您打开图库时,打开创建的相册并单击共享照片并选择墙,然后在墙上显示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)
$facebook->setFileUploadSupport(true);
$response = $facebook->api(
'/me/photos/',
'post',
array(
'message' => $text,
'source' => '@'.realpath($file1) // @-sign must be the first character
)
);