I was reading the Twitter documentation at https://dev.twitter.com/overview/general/user-profile-images-and-banners and it clearly states that:
Alternative image sizes for user profile images You can obtain a user’s most recent profile image, along with the other components comprising their identity on Twitter, from GET users/show. Within the user object, you’ll find the profile_image_url and profile_image_url_https fields. These fields will contain the resized “normal” variant of the user’s uploaded image. This “normal” variant is typically 48px by 48px.
By modifying the URL, you can retrieve other variant sizings such as “bigger”, “mini”, and “original”. Consult the table below for more examples:
Variant Dimensions Example URL normal 48px by 48px http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png bigger 73px by 73px http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_bigger.png https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_bigger.png mini 24px by 24px http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_mini.png https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_mini.png original original http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3.png https://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3.png Omit the underscore and variant to retrieve the original image. The images can be very large.
Twitter API's response is like this for my own account:
{
....
"profile_image_url_https" = "https://pbs.twimg.com/profile_images/559415382457348097/qSYxxIAo_normal.png";
...
}
That image URL works, but it's too small. I need the highest resolution available. I do exactly what Twitter says, and omit the _normal
suffix, and try this URL:
https://pbs.twimg.com/profile_images/559415382457348097/qSYxxIAo.png
But it's not found. Is Twitter docs outdated or am I missing a point?
UPDATE: I've tried with a few friends' profiles and most of them seem to work, and removing any suffixes and adding _400x400.[jpg|png]
also seems to work, but it's undocumented and unreliable, so I really doubt that I should be using this undocumented API in production.
UPDATE 2: I've refreshed my user object as Twitter also states in case of outdated images, but nothing has changed.
for me the "workaround" solution was to remove the "_normal" from the end of the string
Check it out below:
Low res image: https://pbs.twimg.com/profile_images/636894769742897152/frlgaWB8_normal.jpg
Hi res image: https://pbs.twimg.com/profile_images/636894769742897152/frlgaWB8.jpg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With