-1

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'

player0
  • 124,011
  • 12
  • 67
  • 124
unofficialdxnny
  • 105
  • 1
  • 7

2 Answers2

0

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">
Arnooo
  • 206
  • 4
  • 6
  • hi so this didnt really work. its got no preview now – unofficialdxnny Apr 01 '22 at 19:51
  • Also put width and height in separate tags like this instead of putting them in `og:image` : ```html ``` In any case, adding twitter meta tag should not break image preview. – Arnooo Apr 01 '22 at 20:37
0

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">
unofficialdxnny
  • 105
  • 1
  • 7