插入新文件时,新的缩略图功能非常有用。有没有办法更新现有文件的缩略图?我没有设法使用 files().patch() 或 files().update() 方法更新缩略图(在 Java 中)。我没有收到任何错误消息,但上传新缩略图时 Google 云端硬盘中的缩略图并没有改变。
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();
更新:由于我使用完全相同的代码插入带有缩略图的文件(有效)并更新文件,如上面的代码片段所示(不会更新缩略图),因此您使用我的应用程序执行可能是有意义的两种操作。
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?