You'd have to use the Drive REST API method Files: get
. The result of that method contains thumbnailLink
but according to the documentation it is 'a short-lived link to the file's thumbnail. Typically lasts on the order of hours.
Alternatively, you can cache the thumbnail in your application, reducing the count of drive api requests and thus improve your page performance. You need to fetch the information for the uploaded file. The easiest way of caching is to simply download the thumbnail and save it like fileid_thumb
somewhere and upon the next request, you check if such a file exists before actually requesting the thumbnail. Check here the detailed explanation.
You can also upload a thumbnail by setting the contentHints.thumbnail
property on the File resource during an insert or update call as follows:
- Set
contentHints.thumbnail.image
to the URL-safe Base64-encoded image (see RFC 4648 section 5)
- Set
contentHints.thumbnail.mimeType
to the appropriate type for the image format
You can also check the accepted answer in this SO question.
Hope this helps!