You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
mattia o.
8 years agoNew member | Level 2
How use /get_thumbails response
Hi, I'm trying to figure out how I should use the response of the /get_thumbnail call. What I'm actually receiving are some raw data like the following: �����JFIF���������C�...
Greg-DB
Dropbox Staff
The get_thumbails endpoint returns the raw data for the thumbnail itself, and it looks like that's working properly for you.
What you do with that thumbnail data is up to you. For example, you can save it to a local file on your server and serve it in an img tag. Or, you may be able to convert it to base64 and use it in a data URI for the src for an img tag. Both of those are themselves unrelated to Dropbox itself though, so I'm afraid I can't offer too much insight there.
What you do with that thumbnail data is up to you. For example, you can save it to a local file on your server and serve it in an img tag. Or, you may be able to convert it to base64 and use it in a data URI for the src for an img tag. Both of those are themselves unrelated to Dropbox itself though, so I'm afraid I can't offer too much insight there.
mattia o.
8 years agoNew member | Level 2
I'm trying the solution below but I'm not be able to display the image, could you please add a js example?
// data represents the response of the /get_thumbnail
var imgsrc='data:image/jpeg;base64,' + btoa(escape(data)); var img = new Image(100, 100); // width, height values are optional params img.src=imgsrc; document.body.appendChild(img);
- Greg-DB8 years agoDropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/43026363/convert-dropbox-get-thumbnail-response-to-img ]
Hi mattia o., it looks like there are some examples of doing this here:
https://stackoverflow.com/questions/20035615/using-raw-image-data-from-ajax-request-for-data-uri
I recommend looking into using the official Dropbox API v2 JavaScript SDK though, as it may make this easier. For example, you could probably then do something like:
dbx.filesGetThumbnail({"path": "/test.jpg"}) .then(function(response) { var img = document.createElement('img'); img.src=window.URL.createObjectURL(response.fileBlob); document.body.appendChild(img); }) .catch(function(error) { console.log("got error:"); console.log(error); });
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 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!