So...<p><pre><code> if (userAgentIsTwitterPreviewBot() && weCareAboutTheShitFlingingIdiotsDyingPlatform()) {
return previewImageWithBurnedInCaption();
}
</code></pre>
It might not even need code, just some extra HTML: <a href="https://stackoverflow.com/questions/44525446/image-social-meta-tags-property-ogimage-name-twitterimage-itemprop-imag" rel="nofollow noreferrer">https://stackoverflow.com/questions/44525446/image-social-me...</a>