是否可以通过 Twitter's Web Intents 将图像附加到推文中?现在,如果您在消息中放入图像,则图像的完整 URL 将放入消息中,而不是缩短和附加的图像 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查看结果(没有附加图片,只有消息中的完整图片网址....)
当您将图像 URL 粘贴到 Twitter.com 上的推文中时,图像 URL 会自动缩短并将图像附加到推文,因此在您查看推文时会显示该图像。我正在寻找与 Web Intents 类似的东西。
请您参考如下方法:
您不能附加图像,但可以使用 Twitter Card .
With Twitter Cards, you can attach rich photos, videos and media experience to Tweets that drive traffic to your website.
本质上,您需要向页面添加一些元数据。当 Twitter 看到它时,它会自动在推文中插入一张图片。
对于 single photo ,您需要将此代码放在每个页面上(输入您自己的详细信息)
<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" />