Mobile app version of vmapp.org
Login or Join
Voss4911412

: Auto resizing twitter card image to fit twitter timeline my code looks like this <meta property='og:description' content='<?php echo($description) ?>' /> <meta property='og:title'

@Voss4911412

Posted in: #Twitter #TwitterCard

my code looks like this

<meta property='og:description' content='<?php echo($description) ?>' />
<meta property='og:title' content='<?php echo($title) ?>' />
<meta property='og:image' content='<?php echo($imageSrc) ?>' />
<meta property="og:image:width" content= "280" />
<meta property="og:image:height" content= "150" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" value="<?php echo($title) ?>" >
<meta name="twitter:description" value="<?php echo($description) ?>" >
<meta name="twitter:site" value="Wedding Paper Love" />
<meta name="twitter:creator" value="<?php echo($author) ?>" />
<meta name="twitter:image" value=""<?php echo($imageSrc) ?>" />
<meta name="twitter:image:width" value= "280" />
<meta name="twitter:image:height" value= "150" />


twitter card is validating but the image shows like this on timeline


how can I make the twitter card image to show like this



any leads?
thanks
Maria

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Voss4911412

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

Unfortunately this won't be able to be done. The twitter:image:width and twitter:image:height meta tags where supported for the Twitter PhotoCard only however that was depreciated on 3rd July 2015. The summary card with large image (which is what you are using) does not support changing the size of the provided image. Based on Twitter documentation the image linked to in the meta tag should be at least 280px in width and 150px in height. If you wish to maintain the aspect ratio then you would need to increase the height of the image (as in the source image by scaling it up) to the point that the width scales up to 280px. There does not appear to be anyway to change this behaviour with Twitter and I suspect that it is more to do with CSS rules widening the image without adjusting the corresponding height to maintain the aspect ratio.

You will need to remove the height and width meta tags as these are not supported and use larger images.

As a side note there is a hard limit that the image must be less than 1MB in size so even you scale it up to a larger size you have to make sure that the final file size remains below 1MB.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme