动态调整 og:image 的图像大小可以吗?

发布于 2024-12-29 10:06:17 字数 295 浏览 2 评论 0原文

我使用 ImageResizer.net 根据一张较大的源图像动态创建我需要的尺寸的图像。它以类似 url 的方式完成,如下所示:“www.siteUrl.com/ImagePath/ImageName.jpg?width=90&height=90&crop=auto&quality=90”。这会将图像大小调整为 90x90 像素,进行裁剪,并将 jpeg 质量设置为 90%。

此 url 是否可以接受 og:image ,以便当有人在 Facebook 内点赞/链接到我的内容时,它会在 og:image 属性中显示图像的缩略图?

I use ImageResizer.net to create images to dimensions I need dynamically, based on one larger source image. It's done in a url-like fashion, like so: "www.siteUrl.com/ImagePath/ImageName.jpg?width=90&height=90&crop=auto&quality=90". This resizes the image to 90x90 pixels, cropping, and setting jpeg quality to 90%.

Will this url be acceptable to og:image , so that when someone likes/links to my content within Facebook it shows a thumbnail of the image inside the og:image property?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

温馨耳语 2025-01-05 10:06:17

我最近对 ​​og:image 使用带有一些查询字符串参数的 URL,它对我来说效果很好。

如果您不知道:

Facebook 提供了一个调试工具,它允许您检查可以从某个域获取哪些 OpenGraph 元数据:http://developers.facebook.com/tools/debug

I've recently use URLs with some query string parameters for the og:image and it works fine for me.

In case you didn't know:

Facebook provides a debug tool, which allows you to check which OpenGraph meta data could be fetched from a certain domain: http://developers.facebook.com/tools/debug

牵强ㄟ 2025-01-05 10:06:17

是的,这个 URL 接受 og:image 并且工作正常...

我已经像这样使用过这个,例如。

这里我使用图像处理程序文件并传递图像 ID,图像 ID 保存在我的数据库中与图像路径相关联,它在 facebook 上运行良好......

Yes this URL accepts og:image and works fine...

I have already used this like this eg. <meta property="og:image" content="http://www.xyz.com/Handlers/ImageGenerator.ashx?id=de69f1e1-ee64-4bd9-80b8-8546bca4ef45&w=50&h=50" />

Here i am using Image handler file and passing image id and image id is saved in my database associated with image path and it works fine on facebook....

朦胧时间 2025-01-05 10:06:17

请注意,Facebook 希望图像至少为 200 像素

One note, Facebook wants the images to be at least 200px

情痴 2025-01-05 10:06:17

它在我的情况下不起作用。
图像是通过 asp 脚本从 MySQL blob 字段检索的。
调试器显示图像并且没有给出错误,但页面上的按钮不获取图像。

页面: http://www.ffkama.be/html/2_agenda_detail.asp?ps =id51

图片网址:http://www.ffkama.be/root/imager_ag.asp?id=51

更新:
我忘记了 HEAD TAG 中的代码:(
有一点是肯定的,没有 'prefix="og: ht tp://ogp.me/ns# fb: ht tp://ogp.me/ns/fb# 网站:ht tp://ogp.me/ ns/website#"' 在 HEAD 标签中,调试器不会给出错误,图像会显示在调试器中,但图像不会显示在您的页面上。那么页面被缓存了,解决办法只有2个:
1. 重命名页面
2.等待几天缓存过期

It doesn't work in my case.
Image is retrieved from MySQL blob field by asp script.
the debugger shows the image and gives no error but the button on the page doesn't take the image.

Page: http://www.ffkama.be/html/2_agenda_detail.asp?ps=id51

Image URL: http://www.ffkama.be/root/imager_ag.asp?id=51

UPDATE:
I forgot the code in the HEAD TAG :(
One thing is sure, without the 'prefix="og: h t tp://ogp.me/ns# fb: ht tp://ogp.me/ns/fb# website: h t tp://ogp.me/ns/website#"' in the HEAD Tag, the debugger doesn't give an arror and the image shows up in the dubugger but the image won't show up on your page. Then the page is cached and there are only 2 solutions:
1. rename the page
2. wait several days for the cache to expire

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文