How to get user image original size with API 1.1


#1

In 1.0, I could retrieve the image via GET users/profile_image/:screen_name. I don’t see a 1.1 equivalent. Help?


#2

Would love to know the answer to this query as well. Running into this myself and wondering if the 1.0 way of grabbing a user’s profile image (bigger/normal/etc.) will stop working once 1.1 is out and 1.0 is bye-bye.


#3

See [node:10796] for information on determining different sizes for Twitter avatars in 1.1 (and v1 for that matter).


#4

Just what I needed, thanks.


#5

Thank you for your post…really helped to to me


#6

Thanks for https://dev.twitter.com/docs/user-profile-images-and-banners


#7

Is there a way to get it without making a whole new request, like Facebook and Google+:

https://graph.facebook.com/#{facebook_id}/picture
https://profiles.google.com/s2/photos/profile/#{google_id}


#8

twitter bad method…


#9

Thanks TS… :slight_smile:


#10

@jwerre - Hey man, in order to get the original image, take the address they give you from the API call, eg. statuses[0].user.profile_image_url, and strip off the “_normal” from the file name. In other words,

take this:

and make it this:

and that’s the full sized image. Hope that helps!


#11

Thank you very much


#12

in php code bad but funcional xD!, you can replace $size for bigger , mini etc :smiley: or echo str_replace(’_normal’, ‘_bigger’,$tweet->user->profile_image_url)


#13

@pete_klein & @JosueOrtizFdz good trick…!!! Thank YOu…!!!


#14

In API v1.1, the Twitter docs now tell you to “modify the URL” rather than make another request to get the URL for a different image size. So basically, like @pete_klein said, take the profile_image_url from a previous API call (like get friends) and do a string replacement for “normal” to “bigger” or “normal” to “” to get larger profile images.

It feels a little sneaky, but so long as the conventions don’t change it’s one less API call for Twitter’s servers to respond to, and one less API call for your client to make.


#15

Thnq Very very much


#16

str_replace(’**_**normal’, ‘’, $tweet->user->profile_image_url)


#17

Worth noting that you can also just use https://twitter.com/[screen_name]/profile_image?size=original. For instance, https://twitter.com/isaach/profile_image?size=original.


#18

@issaach
Is that an officially supported endpoint? I can’t seem to find it in the docs.


#19

It’s not in the docs because it’s not part of the API. It’s a supported part of the twitter.com site, though.


#20

@isaach

Thanks for the confirmation. Found a bug, described here since it’s not part of the REST api.