I am Uploading the Image from LWC page by using lightning-file-upload
and Making the Image as Public accessible as Below
ContentVersion cv = [select id from contentversion where contentdocumentid =:documentId];
ContentDistribution cd = new ContentDistribution();
cd.Name = 'Test';
cd.ContentVersionId = cv.id;
cd.PreferencesAllowViewInBrowser= true;
cd.PreferencesLinkLatestVersion=true;
cd.PreferencesNotifyOnVisit=false;
cd.PreferencesPasswordRequired=false;
cd.PreferencesAllowOriginalDownload= true;
insert cd;
SELECT DistributionPublicUrl FROM ContentDistribution WHERE ContentDocumentId
If I use the above URL in HTML img
tag, Image is not showing, Can anyone Please help me solve this issue
<div class="slds-align_absolute-center">
<img style="-ms-interpolation-mode:bicubic;border:none;max-width:100%;outline:none;width: 250px;vertical-align: bottom;"
width="32"
src="https://psas--sandboxone.my.salesforce.com/sfc/p/6w0000008jRU/a/6w000000Gn7s/Lic0.Hgi5VwyYli3xJcMMjJs6mauT7fSWxUCTROTjyc">
</div>