We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
taulant
10 months agoExplorer | Level 4
Encountering server timeout on App Engine while attempting to retrieve thumbnails, even with Pagin..
Encountering server timeout on App Engine while attempting to retrieve thumbnails, even with Pagination
Is there a simpler way to get the thumbnails?
I would highly appreciate some help!
public ImageResult getFolderImageContents(String folderPath) {
List<ImageInfo> images = new ArrayList<>();
String cursor = null;
try {
DbxClientV2 dbxClient = dropboxClientProvider.getDropboxClient();
ListFolderResult results = dbxClient.files().listFolder(folderPath);
for (Metadata metadata : results.getEntries()) {
if (metadata instanceof FileMetadata) {
FileMetadata fileMetadata = (FileMetadata) metadata;
String fileName = fileMetadata.getName();
String extension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
if (isImageFile(extension)) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
dbxClient.files().getThumbnailBuilder(fileMetadata.getPathLower())
.withFormat(ThumbnailFormat.PNG)
.withSize(ThumbnailSize.W64H64)
.download(outputStream);
byte[] thumbnailData = outputStream.toByteArray();
images.add(new ImageInfo(fileMetadata.getName(), thumbnailData, fileMetadata.getPathDisplay()));
}
}
}
if (results.getHasMore()) {
cursor = results.getCursor();
}
} catch (Exception e) {
e.printStackTrace();
}
return new ImageResult(images, cursor);
}
Just to clarify, do you mean you're getting a timeout from the Dropbox API, or that some operation on your server is timing out while performing these Dropbox API calls?
Regardless, the Dropbox API does offer a way to get thumbnails in batches. In the Dropbox Java SDK, that's available via the getThumbnailBatch method.
- Greg-DBDropbox Staff
Just to clarify, do you mean you're getting a timeout from the Dropbox API, or that some operation on your server is timing out while performing these Dropbox API calls?
Regardless, the Dropbox API does offer a way to get thumbnails in batches. In the Dropbox Java SDK, that's available via the getThumbnailBatch method.
- taulantExplorer | Level 4
Thank you for your guidance, Graig! It turns out the timeout issue was indeed on my server's end, not with Dropbox. I wasn't familiar with the getThumbnailBatch method you mentioned, but after implementing it, everything is working smoothly. Your quick response was incredibly helpful and pointed me in the right direction. Much appreciated!
About Discuss Dropbox Developer & API
Make connections with other developers
795 PostsLatest Activity: 6 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!