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? Commented Oct 24, 2018 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. Commented Oct 24, 2018 at 6:17
  • So what is the problem? please share a printscreen or error message Commented Oct 24, 2018 at 6:28

2 Answers 2


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=

The image url can be constructed using a little hack -

String picUrl = '';
ContentDistribution cd = [SELECT Id,  DistributionPublicUrl,ContentDownloadUrl, ContentVersionId FROM ContentDistribution where id =: cd.id];
picUrl =  cd.ContentDownloadUrl.replace('download/?' , 'renditionDownload?rendition=ORIGINAL_Jpg&');
picUrl = picUrl.replace('&ids' , '&versionId');

The generated URL from the above result can be used in the tags.

You must log in to answer this question.

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