The new thumbnail feature works great when inserting a new file.
Is there a way to update the thumbnail for an existing file?
I did not manage to update the thumbnail (in Java) using the files().patch() or files().update() methods.
I don’t get any error message, but the thumbnail in Google Drive is just not changing when uploading a new thumbnail.
File file = drive.files().get(fileId).execute();
String encodedImage = Base64.encodeBase64URLSafeString(imageData);
Thumbnail thumbnail = new Thumbnail();
thumbnail.setImage(encodedImage);
thumbnail.setMimeType("image/png");
file.setThumbnail(thumbnail);
drive.files().update(fileId, file).execute();
Update:
As I am using exactly the same code for inserting a file with thumbnail (which works) and updating the file as shown in the code snippet above (which will not update the thumbnail) it may make sense that you use my app to perform both operations.
Login to www.ultradox.com
Copy one of the examples.
This will create a new file on your Google Drive with the correct thumbnail
(as it triggers the insert file method with thumbnail).
Click on the "Customize" button
Scroll down and click on the thumbnail image to upload a new thumbnail
= Thumbnail not changed, but update should be triggered.
So probably something shows up in your logs?
The current behavior is that updates to metadata alone do not allow a change in the thumbnail. So changes to the metadata alone do not take the thumbnail change. I am not sure this is the best behavior, and we will try to improve it to: