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
Lynn Lannin 9Lynn Lannin 9 

Images in rich text fields are not displaying to site users

Hello All,

We have a vfpage that is displayed to our site users. This page displays various rich text fields but when there is an image in the rich text field it is not being shown to the site user. The profile has access to the fields but the images are returning the 'Image not available' error. This really seems to be specific to our site profile and I am wondering if anyone knows if this is a limitation of Sites?
Rahul KumarRahul Kumar (Salesforce Developers) 
1. Create a repeater/data element that is bound to an object with a rich text Area field. 
2. Add the rich text area field to the page and publish the page 
3. Review the published page. Any images on the record will not display, instead, escaped html markup will be displayed

Add the following js to any pages that are having issue: 

var $this = $(this); 
var imgsrc = $this.attr('src'); 

if (imgsrc.indexOf('<img src="/servlet/rtaImage?eid') >= 0) { 
imgsrc = imgsrc.match('src="([^"]*)')[1]; 
imgsrc = imgsrc.replace(/&amp;/g,'&'); 
imgsrc = imgsrc.replace('/servlet/rtaImage','/sfsites/c/servlet/rtaImage'); 


Please refer the below link for reference.

Please mark it as best answer so that question is removed from unanswered questions and appear as a proper solution.

Rahul kumar
Lynn Lannin 9Lynn Lannin 9
Hi Rahul,

My developer tried this just now but it is still not opening. Were you ever able to get it working?
Maharajan CMaharajan C
Hi Lynn,

Please provide the below links to your developers and read it fully:

Can you please Let me know if it works or not!!!

If it helps don't forget to mark this as a best answer!!!

Mohit Sharma 37Mohit Sharma 37
Hi Lynn,
Put a System.debug(); for the image field in apex class, you will saw the url for the image with unwanted string, now you can separate this url using list methods.
Now put it in any property and use this property in your page image tag ( with escape = false if needed).

Mark this as best answer if it works.. :)

Have a nice day!!
Lynn Lannin 9Lynn Lannin 9
Thanks for the ideas guys. Unfortunately, none of these items are working. Does anyone know if it is just a case of Salesforce not supporting the ability to show images embedded in RTF to site users?