Szymad
Szymad

Reputation: 21

Posting on wall photo from album, but bigger

i make code that work! But this is a small problem. Image posted on wall is very small. Code is uploading photo in album and then posting an info to the wall. But image that is posted on wall is too small. When you open a gallery, open created album and click Share photo and select wall then on wall appears BIG PHOTO. So, how to post BIG photo on wall using PHP SDK??? Please help me. I'm learning for tomorrow test i please modificate the code for me. I don't have much time.

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!";
}

Upvotes: 0

Views: 848

Answers (1)

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

Upvotes: 1

Related Questions