7

I've found a lot of people talking about this but no real answers. What I am trying to do is simple just show a little thumbnail preview of a file in a custom component

SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :selectedId

and then i though i could do something like

 <img src="/services/data/v28.0/chatter/files/{!file.ContentDocumentId}/rendition?type=THUMB120BY90" alt="Click to preview" class="contentThumbnail" title="Click to preview" id="ext-gen7"/>

but thats not working?

I also tried going from the Feed itself

public Resume__Feed getApprovedPost() {
        return [Select Id, Type, Title, Body, ContentData, ContentFileName from Resume__Feed where ParentID = :selectedId and Type = 'ContentPost'  ORDER BY CreatedDate DESC, Id DESC limit 1];
}

but wasnt able to get any of that to display?

My ideal is to display using their little flash file previewer but i'd settle for just getting the thumbnail?

any ideas?

11

This will work:

SELECT ContentDocument.LatestPublishedVersionId 
FROM ContentDocumentLink 
WHERE LinkedEntityId = :selectedId

then

<img src="/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId={!file.ContentDocument.LatestPublishedVersionId}" 
    alt="Click to preview" class="contentThumbnail" 
    title="Click to preview" 
    id="ext-gen7"/>

To download the actual content, the URL is

/sfc/servlet.shepherd/version/download/{!file.ContentDocument.LatestPublishedVersionId}

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.