Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
mattia o.
9 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 Community Moderator
9 years agoThe 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.
9 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-DB9 years ago
Dropbox Community Moderator
[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.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!