cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Organizing your research is important to easily review and share it. Learn how Kim uses Dropbox to gather and organize her research right 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: 
1
Ask
2
Comments

Get thumbnail with TypeScript

Re: Get thumbnail with TypeScript

Greg-DB
Dropboxer

@bffy_smmmers The filesListFolder method doesn't return any file data or shared links. It only returns file metadata. The Dropbox API also doesn't return thumbnail links in general. If you want the original file data, you should call filesDownload. If you want a thumbnail of an image file, you should call filesGetThumbnail. Those return the requested data directly (via fileBlob or fileBinary), but not as a link.

Re: Get thumbnail with TypeScript

bffy_smmmers
Explorer | Level 4

@Greg-DB  Thanks, and i am passing in the path to the file, correct? would that not mean the `path_lower` attribute? This does not yield any result for me. Here is my implementation. When i wrap it in a try/catch, i get the error (fetch is not a function) I apologize for not unerstanding, again, I'm new to this. Im trying to put my code in a block, but it gives me an error when i go to post. 

 

async getThumbnail(path: any) {

console.log(`getThumbnail is running with ${path}`)
const data = await this.client.filesGetThumbnail(path)

console.log(<any>data)
//im returning an empty string so it doesnt break anything 
return '';

}

Re: Get thumbnail with TypeScript

Greg-DB
Dropboxer

 

@bffy_smmmers You should use .then and .catch to handle the result/error, like this:

 

dbx.filesGetThumbnail({path: path})
  .then(function(response) {
    console.log("got filesGetThumbnail response:");
    console.log(response);
    console.log("got thumbnail data:");
    console.log(response.fileBlob);
  })
  .catch(function(error) {
    console.log("got filesGetThumbnail error:");
    console.log(error);
  });

 

 

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    bffy_smmmers Explorer | Level 4
What do Dropbox user levels mean?
Need more support?