我已设置Google文档选择器,允许用户从Google云端硬盘中选择图片或上传图片。
一旦选择器加载了一些图像'网格视图中的预览不会加载。这似乎是随机的,错误是404(未找到)。返回404格式的url https://googledrive.com/thumb/fileId?access_token=ya....&size=180
我可以在JavaScript代码中解决这个问题吗?请参阅下面的代码。
var driveView = new google.picker.DocsView(google.picker.ViewId.DOCS_IMAGES);
driveView.setParent(driveFolderId); //sets the default displayed folder
var uploadView = new google.picker.DocsUploadView();
uploadView.setParent(driveFolderId); //set upload parent folder and prevents the user from changing it
uploadView.setMimeTypes('image/png,image/jpeg'); //image/bmp,image/gif,image/tiff
//default file type to png and jpeg
var picker = new google.picker.PickerBuilder()
//.enableFeature(google.picker.Feature.NAV_HIDDEN) //hide navigation
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED) // multi select - bug must be enabled to set the upload folder destination
.addView(driveView) //allows picking files from Google Drive
.addView(uploadView) //allows uploads
.setOAuthToken(gapi.auth.getToken().access_token)
.setCallback(imagePickerCallback)
.build();
picker.setVisible(true);
提前致谢。