Thumbnails for your Custom File Types

Thursday, October 18, 2012 | 11:24 AM


Whenever you upload a file to Google Drive, we try to be smart and understand more about the new file. We index its text content, generate thumbnails and even use Google Goggles to recognize images. However, as any kind of files can be uploaded to Drive, there are cases where it is impossible for Drive to understand what the file content is. For instance, when inserting or updating a shortcut, the file content is not known to Drive and a thumbnail can’t be automatically generated.

Developers can now use the Google Drive SDK to provide thumbnail images for those files. The new thumbnail property on the File resource includes two sub-properties that you can set when uploading a new file or updating an existing one: “image” to contain the base64-encoded image data and “mimeType” to specify one of the supported image formats: “image/png”, “image/gif”, or “image/jpeg”.

As thumbnails must reflect the current status of the file, they are invalidated every time the file content changes, so your application should make sure to always upload a new thumbnail together with the updated content.

For more information and to learn about all requirements and recommendations about this new feature, please refer to the Uploading thumbnails section of the Google Drive SDK documentation, and don’t hesitate to ask us your technical questions!

Claudio Cherubino   profile | twitter | blog

Claudio is an engineer in the Google Drive Developer Relations team. Prior to Google, he worked as software developer, technology evangelist, community manager, consultant, technical translator and has contributed to many open-source projects. His current interests include Google APIs, new technologies and coffee.


David said...

How about supporting SVG thumbnails? Reasoning:

1) With the release of IE 10 the last non-SVG browser will drop off the supported list (IE 8).
2) Rendering images from data models on Google App Engine is very difficult, generally not possible. We run everything server-side on GAE, with 1 exception, image creation. Making a copy of the DOM client-side for this purpose would make life easier for a lot of GAE users.
3) The SVG not only gives thumbnails, but also gives the possibility of offering a panning and zooming previewer within the Drive UI. You might also consider offering such a viewer as an embeddable widget for users to embed in their web pages.