问题描述
我正在使用FB.ui()分享一个页面,在移动时,将og图像裁剪成一个正方形,而不是完全被显示。
我的og图像的自然尺寸1200x622。如何使用FB.ui方法指定其维度?
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?
这是我使用的代码:
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);
});
谢谢,
Andru
Thank you,Andru
推荐答案
您不能更改共享对话框中的共享映像,您需要使用Feed对话框:
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
另外,您应该直接在您的HTML代码中包含大小:
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" />
资料来源:
如果所有这些事情都不适合你,你可以提出一个错误:
If all those things don´t work for you, you can file a bug: https://developers.facebook.com/bugs/
这篇关于如何通过FB.ui设置共享图像宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!