cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How use /get_thumbails response

How use /get_thumbails response

mattia o.
New member | Level 2

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�


		
%# , #&')*)-0-(0%()(���C



(((((((((((((((((((((((((((((((((((((((((((((((((((����@�0"��������������	
�������}�!1AQa"q2���#B��R��$3br�	
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�����������������������������������������������������������������������������������	
������w�!1AQaq"2�B����	#3R�br�
$4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�....

 

Which type of convertion I should apply in order to use it in a <img /> tag?

 

Thanks for your help

7 Replies 7

Re: How use /get_thumbails response

Greg-DB
Dropboxer
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.

Re: How use /get_thumbails response

wishfuluser
Collaborator | Level 8
Hi Greg—I realize this is not the right way to ask what I'm about to ask, but I'm not sure what else to try...and your posts are the best evidence I can find of Dropboxers engaging on this site.

A high number of users are experiencing sync challenges because very basic information (file and folder sizes; number of items in folders; etc.) are not surfaced to users in web view. This seems like very very basic stuff that is unavailable and it is causing lots of users' pain points. Inability to see this very basic information makes Selective Sync highly manual at best or essentially impossible at worst.

This is a very, very old thread with many upvotes and new users joining every week...but it receives no attention because it is in the (perhaps ignored?) feature request area. Would anyone at Dropbox be able to give this some attention?

https://www.dropboxforum.com/t5/Dropbox/See-folder-size/idc-p/213349#M43590

Thanks—from @wishfuluser and hundreds of others.

Re: How use /get_thumbails response

mattia o.
New 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&colon;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);

 

Re: How use /get_thumbails response

Greg-DB
Dropboxer

Hi @wishfuluser, thanks for reaching out, but for future reference, please do not post unrelated replies in threads like this. It makes it more difficult to keep track of the conversation in the thread.

 

That said, I'm afraid I can't help with the topic you linked to, as that's not my area of expertise. I know that other Dropbox employees do read user feedback like this, even if they don't always respond.

 

Re: How use /get_thumbails response

Greg-DB
Dropboxer

[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);
  });

Re: How use /get_thumbails response

wishfuluser
Collaborator | Level 8
Hi Greg—thanks very much for your response.

I realized I was breaching forum etiquette when I posted here, and I do apologize for that.

I would be happy to stay in the original thread—if I thought there was any chance of its receiving attention. But it clearly doesn't; it's many years old and no Dropboxers post anywhere in that area of this site. Customer support has been likewise unresponsive.

You've indicated that other Dropboxers read user feedback—do you know of a particular individual with whom I could interact? I'd be happy to refrain from further messages in odd places like this if there were an active channel I could use.

Thanks again for your attention, and I apologize for my initiating a parallel conversation on this unrelated thread.

Re: How use /get_thumbails response

Greg-DB
Dropboxer

@wishfuluser Unfortunately I'm afraid I don't have anyone in particular I can direct you to.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    wishfuluser Collaborator | Level 8
  • User avatar
    mattia o. New member | Level 2
What do Dropbox user levels mean?
Need more support?