0

Is there a way to show User profile images on a public (force.com) site? It appears not without having to resort to taking the image, base 64 encoding it and storing it somewhere it can access, but I wanted to be sure.

The Chatter email URLs would work but they only last 30 days, and would have to be cached by an authorised user as Apex run by the site guest user can't hit the Chatter API it seems. You can just pull the profile image URL from the user object of course, but it seems that image server gets up to it's own shenanigans - for unauthenticated users it returns a generic 'profile image', not the user's image. The exact same URL returns the proper image for an authed user.

So to sum up - do I have any 'native' options that don't require me to cache the image either as base64 or as an attachment.?

2
  • 2
    The images will show up on public site if the setting ShowProfilePicToGuestUsers on User record is true. This is false by default. You can then just query the Photo url of user.
    – manjit5190
    Sep 17, 2020 at 12:35
  • Son of a... Will test that but highly recommend you post it as an answer @manjit5190!
    – Matt Lacey
    Sep 17, 2020 at 23:39

1 Answer 1

1

The images will show up on public site if the setting ShowProfilePicToGuestUsers on tgat User record is true. This is false by default.

You can then just query the Photo url of user.

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.