1

enter image description hereI created a lightning component,and used it in a community.Now i want to show a rich text area fields image in that component.So,for that i queried that field on opportunity object and showed the data using aura:unescapedHtml tag on lighting component.Now the issue i am facing is,it shows me data(text) in lightning but it doesn't show image in it and gives a message "Image not Available because you don't have privileges."

Can anyone help me with this,how can i show image too? Note:I thought this might be a access to the field issue,but i can see text data and not the image so that removes this possibility,else i wouldn't be able to see the text data i f i hadn't had the permission to see field.

3 Answers 3

2

I got a solution to this.I stored that image in Document and copied its Id from URL and paste it into Rich Text area field.After that simply pass the id in following tag

img src="{!'/servlet/servlet.ImageServer?id='+(Id from Rich text area)+'&amp oid='+(your organistaion Id)}"

2
  • How did you get image stored in document when we dont have access on "lightning:insertImageButton" Here is the code I am using in lightning component <lightning:inputRichText value="<b>HELLO</b>"> <lightning:insertImageButton/> </lightning:inputRichText> Commented Aug 13, 2021 at 8:18
  • Providing access to Document for Guest User helped. Commented Sep 26, 2023 at 8:00
0

You need to copy the public URL for the image and change the source in the image tag in the rich text field in Dev console: enter image description here

1
  • Welcome to Salesforce Stack Exchange (SFSE)! Thank you for including the screenshot. While screenshots are usually helpful, please also include in your post the actual text of that is visible in your screenshot - having the text only in screenshots* makes it impossible for SFSE users with screen readers to know what the text says. | *(without alternate text)
    – Moonpie
    Commented Oct 26, 2021 at 11:06
0

I've fixed this by creating a sharing rule for the target object. In my case we displayed the image in public site, so I've shared it with a guest user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .