问题
I am using FB.ui() to share a page and on mobile the og image is cropped to a square, instead of being desiplayed entirely. The natural size of my og image 1200x622. How can I specify its dimensions using FB.ui method?
Here is the code I am using:
FB.ui({
method: 'share',
action_type: 'og.shares',
href: 'http://example.com/',
title: 'My title',
picture: 'http://example.com/picture.jpg',
description: 'My description'
}, function(response){
console.log(response);
});
Thank you, Andru
回答1:
You can´t change the share image in the Share Dialog, you need to use the Feed Dialog for that: https://developers.facebook.com/docs/sharing/reference/feed-dialog/
If you want to use the Share Dialog, make sure you follow the guidelines to get the best picture after sharing: https://developers.facebook.com/docs/sharing/best-practices#images
Also, you should include the size directly in your HTML code:
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
Source: http://ogp.me/
If all those things don´t work for you, you can file a bug: https://developers.facebook.com/bugs/
来源:https://stackoverflow.com/questions/35248645/how-to-set-share-image-width-via-fb-ui