Tuesday, March 21, 2017

How to create thumbnail/preview of any document or Image or Video in SharePoint

Hi Friends,

In this post, we are going to learn how to generate a thumbnail/preview of any Document or Video or Image in SharePoint.

Recently I came across a requirement to show some document links on a page but the links should be the thumbnail of the document instead of a plain text(document title). Please find the below approach I followed to achieve this.

getpreview.ashx is a http handler used to generate thumbnail/preview of any document(word,pdf, ppt etc.,), Image and Video which resides in SharePoint.

If you observe in SharePoint search results, when we mouse over on the search results we get a preview of that item. This is actually happening through http handler getpreview.ashx

This handler expects a parameter called “path” which expects absolute path of the doc/image/video. Please find the below sample URLs to generate the thumbnail.

Image:

Document:

Video:

This handler has also expects a parameter called “resolution” which has a predefined values 1, 2, 3 etc., for different resolutions of previews/Thumbnails. Please find the below sample URLs with different resolutions



Hope this helps…

2 comments:

  1. I think this will work only in SharePoint Online and not in SharePoint 2013/2016

    ReplyDelete

Popular Posts