Generating Link Previews in Telegram and Signal
Table of Contents
Every programmer understands the following meme:
Though this isn't exactly what I experienced, the feeling referenced by the meme the same feeling experienced when I was trying to generate link previews for images with signal and telegram.
Initially, when you start looking into link previews, it seems as simple as just adding the following image tag:
<meta property="og:image" content="{IMAGE_URL}">
Deceptively, for websites such as twitter, Facebook, and LinkedIn, that is all you need. Things get a little more complicated for Signal and Telegram.
Signal & Telegram
For both Signal and Telegram, after playing with many different ratios, I ended up realizing that a 16:9 aspect ratio works. Unfortunately, the aspect ratios supported are not well documented for either application as far as I can tell. Adding the following code to the head of your application will allow both signal and telegram to fetch the image content for link preview displays.
<meta name="twitter:card" content="summary_large_image" /> <meta property="og:type" content="website"> <meta property="og:image:type" content="image/jpeg" /> <meta property="og:image:width" content="1280"/> <meta property="og:image:height" content="720"/> <meta property="og:url" content="https://joshua-wood.dev/">
Don't believe me? Copy and paste the URL to this page in either application!