complete image is not coming when using feed post api of facebook

320 Views Asked by At

I am using Facebook apis to publish post on my fb page.When I am uploading image to the fb page, image is not coming complete while it is cropped by fb when I see in console.

This is the code I am using

$data = [
                'message' => 'dummy msg',
                'link' => 'http://www.brainbubbling.com/',
                'source' => 'http://localhost/fb_puzzles/test.png', //(for with url)
                'published'=>true,      
                //"access_token" => $page->access_token                 
            ];

$fb->post('/'.$page->id.'/feed', $data, $page->access_token);

I am also attaching the screenshot of the image published on fb

enter image description here

I have tried different-2 images width and height as well but no luck. Please help

1

There are 1 best solutions below

2
On

You are not uploading a picture, you are sharing an URL with a picture. It should follow best practices and you cannot control how exactly it will be cropped for viewing by Facebook: https://developers.facebook.com/docs/sharing/best-practices#images

Better: Use correct Open Graph tags in the source of the shared URL instead.

If you want to upload a picture, use the /photos endpoint instead.