Forum Discussion
Sharepoint Search and .tif files - need help with better image preview
Hello,
Hoping to find some guidance here. I'm trying to do some customizations to my search page (trying to make a photo search much like that most photo library sites, where it just lays out preview images in your search results) and having some trouble with .tif files.
Long story short, the old .tif files don't have a good preview image crawled, just a really tiny/grainy thumbnail image. I want a good image to show on mouseover, and the original tifs are around 60 megs, so I can't load the whole thing. Pngs and Jpegs are just fine, I'm only seeing this with .tif files (which of course are the most important to my marketing department....)
My question is this: I'm seeing gorgeous preview images in the modern photo library. The URLs appear to show that Microsoft is using an external server to serve up these preview images. I want to be able to grab this URL through the Search API, but it doesn't appear to be a crawled property. I would be willing to rebuild this URL in my search template, but I'm not sure if that's possible.
The URLs that I'm wanting look like this: https://northcentralus1-mediap.svc.ms/transform/thumbnail?provider=spo&inputFormat=tif&cs=fFNQTw&docid=https%3A%2F%2Fshlp.sharepoint.com%3A443%2F_api%2Fv2.0%2Fdrives%2Fb!WFk-EAYtSUSvEQWotkO13RJyDx9Iyd1EsoVQezHGmm5NvsjOzFDhRoj3gRsWUpl1%2Fitems%2F01SGRQVO5QWUQD5UJFAFB3HMIOIW5GNEQD%3Fversion%3DPublished&access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvc2hscC5zaGFyZXBvaW50LmNvbUAzYTE3MjNiOS04MTMyLTQ1MDYtYjZjZC04MTlmMTdjMGRhMWQiLCJpc3MiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAiLCJuYmYiOiIxNTI1MTIyMDQyIiwiZXhwIjoiMTUyNTE0MzY0MiIsImVuZHBvaW50dXJsIjoiVVdEOUV3WktOVzh2dHcvZFpUWkdpVVRaMm5vQ1FzTldEKzk2MmFGMFZsbz0iLCJlbmRwb2ludHVybExlbmd0aCI6IjExMSIsImlzbG9vcGJhY2siOiJUcnVlIiwiY2lkIjoiT0RaaE9EWXlPV1V0WkRBeU15MDFNREF3TFdFNU56SXRZalV3WkRoaVlqVmlOVFpsIiwidmVyIjoiaGFzaGVkcHJvb2Z0b2tlbiIsInNpdGVpZCI6Ik1UQXpaVFU1TlRndE1tUXdOaTAwTkRRNUxXRm1NVEV0TURWaE9HSTJORE5pTldSayIsIm5hbWVpZCI6IjAjLmZ8bWVtYmVyc2hpcHxsZXZpLmpvaG5zb25Ac2ltcHNvbmhvdXNpbmcuY29tIiwibmlpIjoibWljcm9zb2Z0LnNoYXJlcG9pbnQiLCJpc3VzZXIiOiJ0cnVlIiwiY2FjaGVrZXkiOiIwaC5mfG1lbWJlcnNoaXB8MTAwMzAwMDA4ODBhOTA3MkBsaXZlLmNvbSIsInR0IjoiMCIsInVzZVBlcnNpc3RlbnRDb29raWUiOiIyIn0.RVdkSlBFRmp4SDErdXZoMHA3SVBLQ0hMWGN1ZlNTbDBQcnp4N1A0R1lqUT0&encodeFailures=1&width=711&height=270&srcWidth=&srcHeight=&cropMode=dochead
Thanks!
1 Reply
- Deleted
It seems that these thumbnails are dynamically generated with access tokens that expire, so a static link in the search results won't be possible now until the new customizations for Microsoft Search are available.
In the meantime, using JS and the Graph API you can get the thumbnail URLs:
- Open the https://developer.microsoft.com/en-us/graph/graph-explorer site to check your REST call syntax.
- Call https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/anothersitecollection:/drives to get the document libraries as drives and save the ID of the document library you need. Substitute your SharePoint tenant for "contoso" and your site collection URL component for "anothersitecollection".
- Call https://graph.microsoft.com/v1.0/drives/b!aXYZmss8ZEiVokyC-JytN274MKTABCdAqaqixLW2-0JqtL9COCftQr9Ct9neeDKJ/root/children to get the documents in the document library. Substitute your long drive ID for the example.
- Call https://graph.microsoft.com/v1.0/drives/b!aXYZmss8ZEiVokyC-JytN274MKTABCdAqaqixLW2-0JqtL9COCftQr9Ct9neeDKJ/items/01EQBDECC66F3P3O5YI5ABCIGG7O6M4Q23/thumbnails to get the thumbnail URLs. Substitute your long document ID for the example.
From my blog post: http://blog.larslynch.com/2019/01/3d-and-other-thumbnails-in-sharepoint.html