I'm using PHP Graph SDK to publish posts with images on Facebook, the source image size is 900x900px.
This is my code in summary:
require_once('php-graph-sdk-5.x/src/Facebook/autoload.php');$fbk_appid = 'xxxx';$fbk_appsecret = 'xxxx';$fbk_tokenpage = 'xxxx';$fbk_pageid = 'xxxx'; $picture = 'img1.jpg';$link = 'https://www.mysite.ext/page.html';$message = 'My message'; $name = 'Title under image'; $tags = '#tags...';$description = 'Description under title'; $fb = new Facebook\Facebook(['app_id' => $fbk_appid,'app_secret' => $fbk_appsecret,'default_graph_version' => 'v3.3' ]);try{ $response = $fb->post('/'.$fbk_pageid.'/feed', array ('picture' => $picture,'link' => $link,'message' => $message, 'name' => $name,'description' => $description, ), $fbk_tokenpage );}catch(Facebook\Exceptions\FacebookResponseException $e){ // Error Graph ( $e->getMessage() ) }catch(Facebook\Exceptions\FacebookSDKException $e){ // Error SDK ( $e->getMessage() ) }// $response->getGraphNode(); //e.g. {"id":"1446491425007649_523376413379549"}
Upon publication the image is always resized to 1200x628px.How to force a custom image format (square for example)?
Thanks!