gpt4 book ai didi

node.js - 在 Facebook `og:image` 标签中使用 Google Cloud Storage 的公共(public) URL

转载 作者:太空宇宙 更新时间:2023-11-03 23:16:41 25 4
gpt4 key购买 nike

我正在使用 Google Cloud Storage 来存储我网站的图像,包括页面的主图像。现在,当我在 og:image 标记中使用该图像的 GCS URL 时,Facebook 不会在链接预览中显示该图像。

在 Facebook 的共享调试器中快速检查会返回此错误:

Invalid content type: https://storage.googleapis.com/moonhope-174701.appspot.com/1548993318172Suasana%20RM%20-%20Kartika%20Abrindah%20Ngantung.jpg ould not be processed as an image because it has an invalid content type.

这是共享页面的 URL。请注意,它可能与og:url

的内容不同
https://amborjo.com/restaurants/rm-syully-wakeke-f91e076125d411e991cc6db964093b53

我网站中的图像已使用 @google-cloud/storage Node.js 模块上传到 GCS,并在已设置 contentType 元数据的情况下上传。

如何修复此错误?

最佳答案

这是一个已知问题,没有简单的解决方案,Facebook、iMessage 和使用图像标签进行预览的各种其他服务都会出现此问题。

我发现解决该问题的最直接方法是将您的应用程序配置为从 Google Cloud Storage 提供图像。使用 Node.js 执行此操作的说明位于:

https://cloud.google.com/appengine/docs/standard/nodejs/using-cloud-storage

关于node.js - 在 Facebook `og:image` 标签中使用 Google Cloud Storage 的公共(public) URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54623388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com