+ Start a Discussion
vijaymindvijaymind 

How to display User Image on Force.com Site

Hi ,

I have badly stuck with the problem , I am getting User Image Url "https://c.cs12.content.force.com/profilephoto/005/T" but if image in not added to User Image a blank photo show but if I added photo the User Image and rendering the VF page on force.com site , The Image not showing its showing just like a burst images !

Best Answer chosen by Admin (Salesforce Developers) 
vijaymindvijaymind

Thanks for reply ,

Well I have resolved the problem .

 

You can see the code and solution on my blog , I had posted that !

 

http://salesforceapexcodecorner.blogspot.in/2012/05/user-photo-not-visible-on-forcecom-site.html

 

 

All Answers

NashalNashal

Hi,

 

Can you post the piece of code here...?

 

Normally we will query the FullPhotoUrl and display in VF page.

 

Similarly like this:

<apex:image value="{!User.FullPhotoUrl}"  height="120px" width="120px"/>

 

 

 

Thanks

vijaymindvijaymind

Thanks for reply ,

Well I have resolved the problem .

 

You can see the code and solution on my blog , I had posted that !

 

http://salesforceapexcodecorner.blogspot.in/2012/05/user-photo-not-visible-on-forcecom-site.html

 

 

This was selected as the best answer
Nikita KarpenkovNikita Karpenkov
There is better solution using chatter connect API.
 
public String getUserPhotoURL(String UserId) {
        ConnectApi.Photo ph =  ConnectApi.ChatterUsers.getPhoto(null, UserId);
        return ph.fullEmailPhotoUrl;
}

Read more in my blog:
http://sforcenotes.blogspot.com/2015/10/solution-to-display-salesforce-user.html
StevenKTVStevenKTV
Hi Nikita,

Does that work for Site guest users? I'm getting an exception:
ConnectApi.ConnectApiException: Guest users are not permitted in internal communities.
Probably because the ConnectApi methods run in the context of the logged-in user (which is the guest user, lacking access to Chatter).

How did you make this work? Thanks in advance!