Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter web intent to post image?

Tags:

twitter

Is it possible to attach an image to a tweet via Twitter's Web Intents? Right now, if you put an image in the message, the full URL of the image is put into the message, instead of the shortened and attached image URL...

https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.website.com%2F&text=MyText+http%3A%2F%2Fwww.website.com%2Fimg%2Fimage.png&url=www.someurl.com

Click here to see the result (no attached image, just a full image url in the message....)

When you paste in an image URL into a tweet on Twitter.com, the image URL is automatically shortened and the image is attached to the tweet, so it shows the image when you view the tweet. I'm looking for something similar with the Web Intents.

like image 667
Jake Wilson Avatar asked Sep 05 '25 03:09

Jake Wilson


1 Answers

You can not attach an image, but you can use a Twitter Card.

With Twitter Cards, you can attach rich photos, videos and media experience to Tweets that drive traffic to your website.

Essentially, you need to add some metadata to your page. When Twitter sees that, it will automatically insert an image into the Tweet.

For a single photo, you would need to put this code on each page (put in your own details)

<meta name="twitter:card" content="photo" />
<meta name="twitter:site" content="@example" />
<meta name="twitter:title" content="My picture" />
<meta name="twitter:description" content="A description" />
<meta name="twitter:image" content="http://example.com/test.jpg" />
<meta name="twitter:url" content="http://example.com/mypage.html" />
like image 103
Terence Eden Avatar answered Sep 08 '25 06:09

Terence Eden