Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I'm trying to use Dropbox SDK to retrieve an imge thumbnail with
filesGetThumbnail method. I used
Dropbox.filesGetThumbnail and I received the response successfully but look like it only return the image's properties such as size, name, path..etc but there was no base64 encoded value in the return as expexted. I tried the same image with the API version 2 and it returned base64. Just wonder if this is a bug or an expected behavior from the SDK.
1. If it's an expected behavior, is there a way to get image data such as base64 encoded or image URL/source.
2. How do I get the response header in order to get the image's etag.
Thanks,
1. The filesGetThumbnail (and any other method that returns data in the response) makes the data available in the response's fileBlob property, if you're running in the browser, and fileBinary if you're running in node.
So, for example, you can do this:
dbx.filesGetThumbnail({path: remoteFilePath}) .then(function(response) { console.log(response); console.log(response.rev); console.log(response.fileBlob); // do whatever you want with the data here, e.g.: objectURL = URL.createObjectURL(response.fileBlob) var downloadButton = document.createElement('a'); downloadButton.setAttribute('href', objectURL); downloadButton.setAttribute('download', response.name); downloadButton.setAttribute('class', 'button'); downloadButton.innerText = 'Download: ' + response.name; document.getElementById('results').appendChild(downloadButton); }) .catch(function(error) { console.error(error); });
2. I covered this a bit in your other thread, but you should use the native properties on the response project. The code example above access the "rev", for instance.
Oh I see, I did not realize the data is included in fileBlob.
Thanks Greg
Hi there!
If you need more help you can view your support options (expected response time for a 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!