function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OdedHarnivOdedHarniv 

Showing an image on a public portal

Hello

 

I have a case where I have a public portal VF page and I want to show an image on this page.

 

Initially I wanted to use the Attachment object (I attached the image to the object showing on the page) but when I did that I got an unauthorized access error, which I assumed is because the Attachment object is not accessible to a Guest user.

 

Same think happened if I use the Document object to store the image.

 

Can someone advise what is the right way to achieve this apart from using a Static Resource?

 

Many thanks

 

Oded

sherodsherod

Did you checked the 'Externally Available Image' checkbox for the document you put into 'Documents'?

 

OdedHarnivOdedHarniv

Yes.

Maybe I'm using the wrong way to access it:

 

/servlet/servlet.FileDownload?file=<TheDocumentID>

 maybe accessing the file from a public page requires a different link?

 

Thanks

 

Oded

Shashikant SharmaShashikant Sharma

You can try one alternative here 

Add the image in Static resource and set Cache Control of resource as public and then use that imgae.

OdedHarnivOdedHarniv

Thank you but I prefer not using a Static Resource.

 

I was finally able to make the Document show.

 

Thank you all

Shashikant SharmaShashikant Sharma

I would suggest you to explain what was the issue when you and how you fixed it. It will help others when they will get stuck in same issue.

OdedHarnivOdedHarniv

Sure;

The permissions on the Document object were not configured correctly.

 

On this note, does anyone know if I can create a preview of the image located as a Doc object using a Formula and the IMAGE function, like I do with Static Resources?

 

Thanks

 

Oded