Adam Gent
Adam Gent

Reputation: 49085

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

If I post a tweet with a link to a picture it will only display the link. But if twitpic post an image link (or rather a link to a page with an image) twitter will render the image (smaller albeit).

I know twitter now has Tweet Entities but those appear to be for reading and not writing.

And yeah I could use twitpic but I rather not since we already have the images saved and ready to go.

Basically how do you become like: twitpic, lockerz, photobucket, yfrog... so on so that twitter recognizes your links as images.

Update: I know twitter will provide upload image api soon but I would rather have the image content on my site.

Upvotes: 23

Views: 22883

Answers (6)

Mrchief
Mrchief

Reputation: 76218

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.

Upvotes: 23

missmatsuko
missmatsuko

Reputation: 168

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

Upvotes: 8

3gon
3gon

Reputation: 1

You can add Images to a tweet when You specify the "media_Ids" in the Api call (statuses/update). To upload media files You have to read this: https://dev.twitter.com/rest/media/uploading-media

I´m working on an automatic solution for this. It´s a bit tricky, but You can find a solutionn at time.

Upvotes: 0

Daniel Luxemburg
Daniel Luxemburg

Reputation: 1

I had this problem too so I made an app for it (possibly overkill?). Use http://jpg.party/SOME_IMAGE_URL and Twitter will do the right thing and put it in a card.

Upvotes: 0

rnaud
rnaud

Reputation: 2622

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.

Upvotes: 6

Matthew Ward
Matthew Ward

Reputation: 351

Twitter decides.... basically they are looking in entities / or using a regex to pick the image url out. I am not so sure about twitpic images being rendered on the twitter.com domain.... I thought they only render images through their media service.

If you are trying to avoid legal issues (in terms of who owns image) best to avoid twitpic.

Upvotes: 1

Related Questions