cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

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: 

Thumbnails

Highlighted

Thumbnails

Explorer | Level 4

Hi, I am using dropbox V2 API (current version from npm 3.0.4). Working with VueJS / Nuxt.

And I am trying to get thumbnails from dropbox folder,

This console message I am getting (Dropbox-sdk.min.js)

TypeError: t.buffer is not a function

And this is code I am executing

dbx.filesListFolder({ path: '/Website/1. Overview', recursive: true, include_media_info: true, include_deleted: false, include_has_explicit_shared_members: false, include_mounted_folders: false, limit: 5 })
  .then(function(response) {
    console.log(response);
    dbx.filesGetThumbnail({ path: response.entries[1].path_display, format: 'jpeg', size: 'w64h64' })
      .then(function(result) {
        window.data = result;
        console.log(result);
      })
      .catch(function(error) {
        console.log(error);
      });
  })
  .catch(function(error) {
    console.log(error);
  });

So, one thing I noticed that my files in that folder have property with "file" value

{
 ".tag": "file"
}

should it be any of image formats "jpeg" | "png"

 

Thank you for any kind of answer  

6 Replies 6
Highlighted

Re: Thumbnails

Dropboxer
Regarding the TypeError issue, please refer to this recent JavaScript SDK issue for more information and a workaround:

https://github.com/dropbox/dropbox-sdk-js/issues/172

(Note that filesDownload and filesGetThumbnail download data in the same way.)

The ".tag" value is expected. That identifies the type of the entry, and will be one of "file", "folder", or "deleted", not the file type. For the file type, please refer to the file extension in the path or name.
Highlighted

Re: Thumbnails

Explorer | Level 4

Hi again, I fixed that issue, but I have one more question that I couldn't find answer for.

 

filesDownload or filesGetThumbnail returns object with fileBinary property. I can't in any way I tried convert that data to image.

Most of the time I get this exception

DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

Unless I do this

...
img.src='data:image/jpeg;base64,' + window.btoa(unescape(encodeURIComponent(response.data.fileBinary)));
...

But again it is unreadable

And here is screenshot of original fileBinary data and converted data with code above

Screenshot from 2018-02-11 00.15.13.png

Highlighted

Re: Thumbnails

Dropboxer
It looks like you opened another thread for this, so I'll follow up there:

https://www.dropboxforum.com/t5/API-support/Binary-to-image/m-p/264555
Highlighted

Re: Thumbnails

Dropboxer
The original `t.buffer is not a function` issue should be fixed in the latest version of the library, currently v4.0.3.
Highlighted

Re: Thumbnails

Explorer | Level 3

not able to convert fileBinary to url in nodejs.

Highlighted

Re: Thumbnails

Dropboxer

@rajshree1996 If you need help using the Dropbox API/SDK, please open a new thread with more details about the issue or question. Thanks!

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?