Use Twitter Profile Picture direct URL as Twitter:Image?

image
tweet-preview
profile
cards

#1

Hello,

I’m finishing the new website of my Twitter game @whattheshot where a snapshot of a movie is published and users have to guess the title of the movie. I’m encountering a problem with Twitter Cards for a specific kind of pages: the user profile page. Each of my players will have its own page with its Twitter avatar/banner, and some statistics about him in my game.

I wanted to create a Twitter Card for these pages just like I did successfully for the rest of my website, but in this case, the preview image doesn’t appear. As this is a profile page, I naturally used their Twitter Avatar as preview image in the Twitter Card, but it seems Twitter doesn’t allow me to use the direct URL of the avatar? (maybe to avoid people getting confused between a twitter card and a real (RT)tweet?).

My Page: https://beta.whattheshot.com/user/SoParra
The direct link to the Twitter Avatar of my user: https://pbs.twimg.com/profile_images/820671121884413952/lZGhUzcd_400x400.jpg

The image loads correctly in the page, and in my browser, but not in the Twitter Cards Validator:

I checked with curl -A Twitterbot https://beta.whattheshot.com/user/SoParra and meta datas appear at the top.

That will make sense if Twitter forbids the use of Twitter Avatar as preview images, but I just wanted to have the confirmation before finding a solution.

Thanks a lot!

Yann


#2

I see this in your page:

<meta name="twitter:image" content="https://pbs.twimg.com/profile_images/820671121884413952/lZGhUzcd_bigger.jpg|replace:'bigger':'400x400'"/>

Try changing that to the URL you provided in your post above. Those URL parameters in the image URL are probably causing issues.


#3

Hi Andy. Thanks, I fixed the URL. Unfortunately, the preview image doesn’t appear.

Here is another user Profile (just to avoid cache issues on the other one) : https://beta.whattheshot.com/user/MaxLaMenace_89

URL in twitter:image is fixed, appears correctly in curl, but still nothing in the Card Validator.


#4

Well hmm - I’m surprised that didn’t help. I don’t see a reason why the profile images would not work. I guess given they could be updated often it might not be a great way to implement this anyway, with the cache etc. Do you have any alternative ways to host the images? Maybe grab the current profile image and store locally when the user sets up an account?


#5

Yeah this is odd. I can definitely save the images locally and use them but if I could avoid saving profile pictures of all my players “just” for a Twitter Card, that would be great :smile:

But I guess that’s the only solution for now yes, or just use a default twitter image.

Thanks for your help though. If by chance you find the reason of this behavior, don’t hesitate to contact me, I’m curious!

Regards,

Yann


#6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.