Facebook打开图表标签为博客 - OG图像太小。我可以指定全尺寸图片而不是缩略图吗? [英] Facebook Open graph tags for blogger - OG Image is too small. Can I designate full size image instead of thumbnail?

查看:244
本文介绍了Facebook打开图表标签为博客 - OG图像太小。我可以指定全尺寸图片而不是缩略图吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Blogger不允许您在每篇文章中指定开放图表图片。目前,模板中有一段代码将自动生成的缩略图指定为Facebook的开放图形图像。问题是,缩略图是72 * 72,而Facebook现在在OG图像中至少需要200px的宽度,或者默认为符合标准的页面上的第一个图像,这是我的头像。

Blogger does not allow you to designate an open graph image in each post. Currently, there is a piece of code in the template that designates the automatically generated thumbnail as the open graph image for facebook. The problem is, the thumbnail image is 72*72 and Facebook now requires at least a 200px width in the OG image or it defaults to the first image on the page that meets the criteria, which is my header image.

我的问题是这样的:我可以在我的模板中修改这个代码,以指定发布中的全尺寸图像而不是生成的缩略图?如果是这样,怎么样?非常感谢你,如果你能帮忙!

My question is this: Can I amend this code in my template to designate the full size image in the post instead of the generated thumbnail? If so, how? Thank you so much if you can help!


推荐答案

我知道这是一个古老的问题(2年前),但我希望我的答案可以帮助别人寻求解决方案。

I know this is an old question (2 years ago), but I hope my answer can help other peoples when they are looking for a solution.

目前,我们正在使用此代码在Facebook上共享链接时创建缩略图:

Currently, we are using this code to create thumbnail when sharing links on Facebook:

< meta expr:content ='data:blog.postImageThumbnailUrl'property ='og:image'/>

而Blogspot会生成如下HTML代码:

And Blogspot will generate the HTML code looks like this:

< meta property =og:imagecontent =http://1.bp.blogspot.com/-t5-HTAnnThU/Vicp0SSNPeI/AAAAAAAACZw/9lbrjwRY64A/s72 -c / get-free-xyz-domain.png/>

是的,正如你所说,这是一个72x72的图像。但是你知道我们可以根据图像URL更改图像大小吗?

Yes, as you said, it is a 72x72 image. But did you know that we can change the image size based on the image URL?

当您替换 s72-c w600-h315-c (600x315):

When you replace s72-c to w600-h315-c (600x315):

现在,问题是我们如何替换新的链接?我使用以下技巧:

Now, the problem is how we can replace the new link? I used the following tricks:

< meta expr:content ='http://junookyo.freevnn.com/?img= + data:blog.postImageThumbnailUrl'property ='og:image'/>

这里是简单的PHP代码:

And here is the simple PHP code:

<?php

if (isset($_GET['img']) && filter_var($_GET['img'], FILTER_VALIDATE_URL)) {

    $img = $_GET['img'];

    if (strpos($img, '/s72-c/') !== FALSE) {

        $img = str_replace('/s72-c/', '/w600-h315-c/', $img);

        header("Location: {$img}");

    }

}

exit;

最终结果:

阅读我的博文更多细节。

这篇关于Facebook打开图表标签为博客 - OG图像太小。我可以指定全尺寸图片而不是缩略图吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆