My files are stored in 'files' under App launcher.

I have a Rich text box field 'description' in a object wherein i enter text and images. Here, the images are entered as tags. the 'src' attribute of tag contain the public url of the image which i stored in 'files' in the App launcher.

For eg:

<img src="https://<domain>.cs21.my.salesforce.com/sfc/p/#q00000000sNA/a/q00000008a0b/6woo3x9YQNR7vTXR2oOOmknAOjpytHMEnZc2nGQ3F54"/>

Now, i want to build a lightning component 'preview', which will take this field 'description' and read the image and show the text and image to the client to review.

I am stuck on how to read the img and display the image from the URL.

I am new to lightning. Can you please help me to achieve this?

  • you can use the img tag like you did, but you need to make sure that your url is correct. try opening that url on your browser first. how do you build your url? – Itai Shmida Oct 24 '18 at 6:14
  • @itaiShmida i selected the file from the 'files' app launcher and took the public link.. the public link is opening the correct image on browser. – Ritz Arlekar Oct 24 '18 at 6:17
  • So what is the problem? please share a printscreen or error message – Itai Shmida Oct 24 '18 at 6:28

Just posting my answer to help those who are facing the same issue.

The problem was with the src link. When we upload file in 'files' app launcher and we get a public link, this link will open in other browsers publicly but cannot be used for src purpose. To get the actual link, just open the image using the public link -> right click and select 'Copy image location'. the link which you get now is the suitable to insert in src attribute of .

for eg:

Below public link after uploading file on 'files' app luncher


Below correct link we get from 'Copy Image Location'

https://<domain>/sfc/dist/version/renditionDownload?rendition=ORIGINAL_Jpg&versionId=068q0000000RAdv&operationContext=DELIVERY&contentId=05Tq0000001RiQf&page=0&d=/a/q00000008a0b/6woo3x9YQNR7vTXR2oOOmknAOjpytHMEnZc2nGQ3F54&oid=<organization Id>&dpt=null&viewId=
| improve this answer | |

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.