Reputation: 29
I have an generated image on my website using php and I want to have a "tweet this image" link which puts something like
"This image was generated at
example.com
on a twitter post.
How would that be possible?
I read that it's only possible to embed images from twitter servers themselves but is there a way to upload them automatically once the user clicks on "tweet this image"?
I currently have this:
<a class='fab fa-twitter'
target='_blank'
href='twitter.com/intent/tweet?url=<img-link>"
. $player->getIgn()
. "&via=<name>&text=My%20first%20join%20on%20Hypixel%20was%20"
. $player->getYears()
."%20years%20ago!'>Tweet this image</a>
Upvotes: 0
Views: 361
Reputation: 22343
Take a look at the Twitter markup guide.
twitter:image
URL of image to use in the card. Images must be less than 5MB in size. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported. Used with summary, summary_large_image, player cards.
Example:
<meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-articleLarge.jpg">
Upvotes: 2