简体   繁体   中英

Get profile image Linkedin in Rails

I have seen that some apps show the photo of the users or customers. I want to do the same with a CRM we are doing. We want to add the image of the contacts in the CRM: I understand these apps are getting these images from somewhere... Where are these apps getting the images of their customers from? Gravatar? Linkedin? Any other place. IF you let me know, I would really appreciate. Thanks

You can use a service like FullContact or Vibe to do social data enrichment, including getting their profile images.

However if all you want is their profile picture, it's much easier just to use Gravatar. Here's a helper from one of my apps:

module AvatarHelper
  def avatar_url(contact, size=:medium)
    if contact.email.present?
      gravatar_id = Digest::MD5.hexdigest(contact.email.try(:downcase))
      "//www.gravatar.com/avatar/#{gravatar_id}.png?d=blank&s=200"
    else
      image_path("default-user-icon-profile.png")
    end
  end
end

Note that not everybody has a gravatar image though. This method will return the "blank person" placeholder image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM