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
sashamsasham 

Public link for the image file that is already saved in salesforce file using Apex

Hi Anybody can help on this 
Created custom lightining  component and uploded image (Using Apex code )
ContentVersion Ver = new ContentVersion();
        Ver .ContentLocation = 'S'; 
        Ver.PathOnClient = 'x.png'; 
        Ver.Title = fileName; // Display name of the files
        Ver .VersionData = EncodingUtil.base64Decode(base64Data);
        Ver .isMajorVersion = false; 
        insert Ver ;

And then 
 Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:Ver.Id].ContentDocumentId;
        ContentDocumentLink doc = new ContentDocumentLink();
        doc.ContentDocumentId = conDocId;
        doc.LinkedEntityId = parentId; 
        doc.Visibility = 'AllUsers';
        doc].ShareType = 'V';
        insert doc

After uploaded, I need get this image link (which is public) by quering for this image. Note that many images have been uploaded to the same record.