I am trying to make an application that would present chatter content to be displayed in a lightning community.

What would be the best way to display the profile photo of the user who posted this question/comment in chatter? And also is it possible to access this photo in an anonymous community?

I am able to get the URL of the smallphotourl through a hack-ish way of the user who created the chatter message. But, this url is using the salesforce internal domain (ex. na35.salesforce.com/profilephoto/<UserID>/T) so that would not work inside a lightning community.


This should not create any issue as long as you use User smallPhotURL or fullPhotoURL.

The same approach is being used in this Lightning Utility Pack Appexchange Lightning Tasklist component.They are using the fullPhotoURL field

In our production, that URL looks like:-


  • So they are using an Apex Controller to get the User object and get the value for smallphotourl? And you can display this directly in a lightning community? – Etienne Rocheleau Dec 22 '16 at 19:17
  • Yes, field is accessible though controller only. I checked their component and the URL I had in my User. – Ashwani Dec 22 '16 at 19:18
  • This is the url I get when right clicking on the image and inspecting in a lightning community: erocheleau-dev1-developer-edition.na35.force.com/… – Etienne Rocheleau Dec 22 '16 at 19:35
  • This is the url I get when getting the smallphotourl of the user who posted the chatter content: c.na35.content.force.com/profilephoto/72941000000TaLv/T (First one works, this one redirects to the login page). – Etienne Rocheleau Dec 22 '16 at 19:36
  • I just checked the component in community the url seems like /sfsites/c/profilephoto/72928000000CxmT/F. @EtienneRocheleau – Ashwani Dec 22 '16 at 19:38

After some more digging around and investigation and help from @Ashwani:

The correct url to use in any case, seems to be a relative URL built from the smallphotourl field:


This is an example of an <img src= that would work both in lightning communities and in a visualforce page.

As a side note, if the user chose to not make his photo public on chatter: (Profile > Edit your chatter photo > Check/uncheck "Show my photo on publicly accessible pages") This url will resolve to a placeholder photo from Salesforce. Which is neat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.