Search code examples
phphtmltwitter

PHP How to include an image with a link in a tweet


I am trying to make a twitter button when the user clicks on it , it send out a tweet and it has a (Link with an image) similar to this :

enter image description here

i already tried adding the details in the meta

<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="">
<meta property="twitter:title" content="">
<meta property="twitter:description" content="">
<meta property="twitter:image" content="images/e.png">
<meta property="twitter:text:title" content="">
<meta name="twitter:creator" content="@abc">

and i also tried different links in https://twitter.com/share?ref_src=twsrc%5Etfw

<td width="250px" align="left"><a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="" data-url="<?php echo "https://e3t2raaf.com/q=" . $row['username'] . "" ;?>" data-show-count="false">

but still nothing worked is there a specific link i am missing or how can it be done to send the images/e.png with the link i am tweeting through the twitter button or has this question been answer before


Solution

  • You need to include that information in the website, yes (although twitter:text:title is not a valid tag, and the value of twitter:image must be a fully qualified https domain e.g. https://example.com/images/e.png)

    The image - part of the Twitter Card - will not be shown until the Tweet is posted and rendered in the timeline.