Setting profile image size

Sep 27, 2012 at 1:02 AM

I am new user of LinqToTwitter. I have figured out how to retrieve a user's profile image url, but how do you set the image size?  Thanks in advance.

Coordinator
Sep 27, 2012 at 3:11 AM

Hi,

You can modify the URL with the image size, which defaults to "normal", by replacing "normal" with the size.  Here's documentation on the Twitter developer's site that describes what sizes are available:

https://dev.twitter.com/docs/user-profile-images-and-avatars

Joe

 

Sep 27, 2012 at 8:57 AM

Ok here is my code below, and it works fine, but is there something I am missing.  I assumed there was a more direct way of setting the image size property within a linq statement.

var dbTwitter = new TwitterContext(TwitTools.GetAuth());

            var users = dbTwitter.User.Where(u => u.Type == UserType.Show &&
                u.ScreenName == twitterName);

            var url = users.FirstOrDefault()
                .ProfileImageUrl;

            url = url.Replace("_normal", "");

Coordinator
Sep 27, 2012 at 9:55 AM

It's all based on the Twitter API (v1.1) and what they offer as options.  It's definitely not relational, which might be confusing for people working in that environment. A REST interface only returns a static entity that is pre-defined.  If you already grok this, that's cool, but I just wanted to clarify for anyone else reading this thread. Therefore, you can make the query to get those entitites, but still have to shape the results as you need in your client code. Unless you're communicating with an OData endpoint that gives you more options, a typical REST endpoint won't be as flexible.  That said, Twitter is a business who listens to customers and if you have some ideas that might make their interface better, I'd say go for it.  Their forums ar at https://dev.twitter.com/.

If I'm missing the point you're making, please clarify.  I think that this type of discussion, identifying opportunities and real-world constraints is a good discussion.

Joe

Sep 27, 2012 at 11:26 AM

I think I am getting the picture now.  I just wanted to make sure I was on the right track with understanding how LinqToTwitter works.  I appreciate the timely response, and hope that you continue your support of this wonderful app.

Rich