如何调整网站图像预览的大小

发布于 2025-01-18 19:11:06 字数 640 浏览 2 评论 0原文

嗨,我正在使用以下代码来设置图像预览

< html xmlns =“ http://www.w3.org/1999/xhtml” xmlns:fb =“ http://ogp.me/ns /fb#“> < meta属性=“ og:image” content =“ https://i.imgur.com/vjuu72s.png” width =“ 1200”高=“ 600”/>

它设置了发送的链接的预览确实很小(请参见下图)

“这是Discord上的图像预览”

但是我想要它像下面的图像

“这是githubs示例”

我如何实现这一目标?我已经尝试执行以下

< meta属性=“ og:image” content =“ https://i.imgur.com/vjuu72s.png” width =“ 1200” height =“ 600”/>

实际图像大小为'1200x600'

Hi I'm using the below code to setup a image preview

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<meta property="og:image" content="https://i.imgur.com/VjUU72S.png" width="1200" height="600"/>

It sets up the preview for the link sent but it is really small (see image below)

This is the image preview on discord

However I want it to be alot bigger like the below image

This is Githubs Example

How can i achieve this? ive already tried to do the below

<meta property="og:image" content="https://i.imgur.com/VjUU72S.png" width="1200" height="600"/>

The actual image size is '1200x600'

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

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

发布评论

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

评论(2

半步萧音过轻尘 2025-01-25 19:11:06

Discord 依赖 twitter 卡 的元标记来渲染图像尺寸。有关 twitter 的更多信息网站

所以,只需将其添加到您的头脑中:

<meta name="twitter:card" content="summary_large_image">

Discord relies on the meta tag of twitter cards to render image sizes. More info on twitter website

So, just add this in your head :

<meta name="twitter:card" content="summary_large_image">
放飞的风筝 2025-01-25 19:11:06

我已经找到了解决方案并实现了我的目标。

<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="description" content="Im Danial Ahmed and this is my personal 
website">
<meta name="twitter:image:src" content="https://imgur.com/DaUY6vk.png">
<meta name="twitter:image:src" content="https://imgur.com/DaUY6vk.png">
<meta name="twitter:site" content="@unofficialdxnny">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="unofficialdxnny (Danial Ahmed) 
index.html">
<meta name="twitter:description" content="Im Danial Ahmed and this is my 
personal website">
<meta property="og:image" content="https://imgur.com/DaUY6vk.png">
<meta property="og:image:alt" content="Im Danial Ahmed and this is my 
personal website">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="600">
<meta property="og:site_name" content="unofficialdxnny">
<meta property="og:type" content="object">
<meta property="og:title" content="unofficialdxnny (Danial Ahmed) Website">
<meta property="og:url" content="https://unofficialdxnny.netlify.app">
<meta property="og:description" content="Im Danial Ahmed and this is my 
personal website">
<meta name="expected-hostname" 
content="https://unofficialdxnny.netlify.app/">
<meta name="theme-color" content="#1167ab">

I have come to a solution for this and achieved my goal.

<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="description" content="Im Danial Ahmed and this is my personal 
website">
<meta name="twitter:image:src" content="https://imgur.com/DaUY6vk.png">
<meta name="twitter:image:src" content="https://imgur.com/DaUY6vk.png">
<meta name="twitter:site" content="@unofficialdxnny">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="unofficialdxnny (Danial Ahmed) 
index.html">
<meta name="twitter:description" content="Im Danial Ahmed and this is my 
personal website">
<meta property="og:image" content="https://imgur.com/DaUY6vk.png">
<meta property="og:image:alt" content="Im Danial Ahmed and this is my 
personal website">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="600">
<meta property="og:site_name" content="unofficialdxnny">
<meta property="og:type" content="object">
<meta property="og:title" content="unofficialdxnny (Danial Ahmed) Website">
<meta property="og:url" content="https://unofficialdxnny.netlify.app">
<meta property="og:description" content="Im Danial Ahmed and this is my 
personal website">
<meta name="expected-hostname" 
content="https://unofficialdxnny.netlify.app/">
<meta name="theme-color" content="#1167ab">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文