I’m using omniauth-twitter gem to authenticate users through twitter. I am also using their Twitter profile image as their avatar for my site. However, the image I get from Twitter is low resolution. I know Twitter has better resolution pics available. How do I get it?
Here is what I am currently doing. It is a method in the user model. It works, just doesn’t get me a good quality pic:
user.rb
def update_picture(omniauth)
self.picture = omniauth['info']['image']
end
I thought maybe I could pass a size option onto it somehow, but can not seem to find a good solution.
I’m using the omniauth-twitter gem as well. In the apply_omniauth method of my User model, I save the Twitter image path like this, stripping the _normal suffix:
Then I have a helper method called portrait that accepts a size argument. As Terence Eden suggests, you can just replace the _size suffix of the filename to access the different image sizes that Twitter provides: