Exile3daime
Exile3daime

Reputation: 611

How to show thumbnail image from Google Drive API

I got the thumbnailLink DoFu of my uploaded public file in Drive by following the Google Drive API Samples with Javascript. The image can be shown when opening the link on browsers. However, it cannot be shown on HTML image element.

enter image description here

I also tried to access this image via API key with "GET https://www.googleapis.com/drive/v3/files/{FILE_ID}?fields=contentHints%2Fthumbnail%2Fimage%2CthumbnailLink&key={YOUR_API_KEY}", and it can return me an object within a thumbnailLink. However, it cannot be shown on image element either.

How can I get the real image source link in order to show it on my web page?

Upvotes: 1

Views: 4078

Answers (1)

Exile3daime
Exile3daime

Reputation: 611

I finally use this way to solve it. To get thumbnail link with scopes drive and drive.readonly , and set it to https://drive.google.com/thumbnail?authuser=0&sz=w320&id=[fileid]. It get let user get thumbnail image to private data when logging in.

Upvotes: 2

Related Questions