How do I add an image to a tweet or how does twitter decide which image urls to render

Update: As noted in comments, refer to this answer for updated information. Twitter now supports a more straightforward way for achieving the same effect.

Twitter Cards overview: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards


Twitter scrapes the URL for images and display them inline for the companies it has partenered with.

The current list includes: DailyBooth, DeviantART, Etsy, Flickr, Justin.TV, Kickstarter, Kiva, Photozou, Plixi, Twitgoo, TwitPic, TwitVid, USTREAM, Vimeo, yfrog, and YouTube. twitter.com/newtwitter

They also support iTunes, blip.tv, Instagram, Rdio, SlideShare, and Dipdive: http://blog.twitter.com/2010/12/now-playing-on-newtwitter-embedded.html

So for you to become like twitpic etc, you need to have a partnership with them. There is no API trick for that. The other way is to use one of those services which is not waht you prefer but seems to be the easiest way out.


The top answer to this question is out of date.

Twitter will now show an image for a link shared in a tweet if it contains the following meta info:

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{full/absolute image url here}">

https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary-card-with-large-image


Twitter now has an API for what they call Cards. It is using HTML Meta tags just like the Facebook implementation.

https://dev.twitter.com/docs/cards

It is only for white listed approved domain now.

Tags:

Image

Twitter