Thumbnails in VisualForce

March 12, 2015

Most of the files uploaded to Chatter have a thumbnail next to them which shows the snapshot of the first page of the file.

Well, you too can generate the thumbnail for the files you upload and display those in your VisualForce Pages.

Thumbnails are dynamically generated whenever you access the below URL:

/sfc/servlet.shepherd/version/renditionDownload?rendition=**THUMB120BY90**&versionId=**<VersionId>**&operationContext=CHATTER

This link is delivered through either the content.force.com domain - https://c..content.force.com/ or the Community URL - http://.force.com/

This URL has 2 important Parameters:

Rendition: Specifies the Size of the Thumbnail to be generated.

Available Sizes: THUMB120BY90, THUMB240BY180, THUMB720BY480

Version ID : The Content Version ID of the Document. This is available from the RelatedRecordId Field of a FeedItem or by querying the ContentVersion Object.

Thumbnails in Visualforce