1

插入新文件时,新的缩略图功能非常有用。有没有办法更新现有文件的缩略图?我没有设法使用 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?
4

1 回答 1

1

当前行为是仅对元数据的更新不允许更改缩略图。因此,仅对元数据的更改不会导致缩略图更改。我不确定这是最好的行为,我们将尝试将其改进为:

  1. 允许缩略图更新
  2. 报告错误而不是看起来成功
于 2012-10-29T23:06:57.357 回答