4

Does anybody know how I can retrieve the profile picture for a user from salesforce? I need access to the url of the picture.

Is it stored somewhere as a field value?

1 Answer 1

8

Use user's FullPhotoUrl and SmallPhotoUrl fields

VF code:

       <apex:page controller="cls_PhotoUrl">
            <apex:form>
                <apex:image value="{!Photolink}"/>
           </apex:form>
        </apex:page>

Controller code:

Public class cls_PhotoUrl
{
     public string Photolink{get;set;}
     Public cls_PhotoUrl()
     {
         User u = [Select u.SmallPhotoUrl, u.FullPhotoUrl 
                     From User u where u.id=:Userinfo.getUserid()];
        Photolink = u.FullPhotoUrl;
     }
}
1
  • 1
    I will try it in a moment, you are awesome!
    – Arthlete
    Commented Apr 7, 2016 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .