Skip to content

Instantly share code, notes, and snippets.

@mculp
Created November 6, 2012 01:50
Show Gist options
  • Select an option

  • Save mculp/4021973 to your computer and use it in GitHub Desktop.

Select an option

Save mculp/4021973 to your computer and use it in GitHub Desktop.
what is wrong with this picture? getting larger photo from linked in
gem 'linkedin'
LinkedIn.configure do |config|
config.token = "..."
config.secret = "..."
end
def grab_photo(user)
photo_url = case @omniauth_data['provider']
when 'facebook'
provider.info.image
when 'twitter'
provider.info.image.gsub(/_normal\./, '')
when 'linkedin'
client = LinkedIn::Client.new
client.authorize_from_access(@omniauth_data['credentials']['token'], @omniauth_data['credentials']['secret'])
client.profile(:fields => ['picture-urls::(original)']).picture_urls.all.first
end
user.profile.photo.download!(photo_url) unless user.profile.photo
end
@mculp
Copy link
Author

mculp commented Nov 6, 2012

Apparently, you have to make an additional API call to LinkedIn just to grab the originally-sized photo. Ridiculous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment