Card creation failure on image from twitter:image meta tag

image
website-card

#1

took image url from twitter:image tag

uploaded it succesfully, got media_string_id.
Trying to create website card - and getting

{ media_id: 740655211711205400,
media_id_string: ‘740655211711205376’,
size: 71870,
expires_after_secs: 86400,
image: { image_type: ‘image/jpeg’, w: 460, h: 259 } }
starting to create website card;
{ [Error: Twitter-Ads API Error: The image file should have width : height ratio of 5 : 2]
allErrors:
[ { code: ‘INVALID_IMAGE’,
message: ‘The image file should have width : height ratio of 5 : 2’,
parameter: ‘’ },
{ code: ‘INVALID_IMAGE’,
message: ‘The image should be wider than 800 pixels’,
parameter: ‘’ },
{ code: ‘INVALID_IMAGE’,
message: ‘The image should be taller than 320 pixels’,
parameter: ‘’ } ] }
failed to create card

This means the publisher made mistake in its photo? what’s the standard fallback? take og:image? starting to play with image myself?


#2

It’s certainly possible that cards from websites are setup incorrectly from an Ads API rule perspective, the limitations are called out here: https://dev.twitter.com/ads/creative/revenue-cards

Cards created via meta tags can be verified as valid or not with the Card Validator tool but those can be leveraged outside of the Ads API as well. My understanding is the ratios are strictly enforced so that the images do not have to be stretched or displayed in a strange way.


#3

thanks!

  1. Whats the right behavior on invalid image? should I programatically try to resize it - or this is not recommended?
  2. Didn’t find interface for card validator…any way to code this in my logic?