cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Path for .NET SDK thumbnails

Explorer | Level 3

The .NET SDK examples seen to be thin.  I am looking to display thumbnails from image files on Dropbox.   I have the BeginGetThumbnail method but am having difficulty implementing it.   It is returning null for me.  Is this an async method??

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Path for .NET SDK thumbnails

Dropboxer
Dropboxer

1. To set parameters like those, you should supply values like this:

  var asyncResult = this.client.Files.BeginGetThumbnail (path, Dropbox.Api.Files.ThumbnailFormat.Jpeg.Instance, Dropbox.Api.Files.ThumbnailSize.W64h64.Instance); 

2. That IsPhoto is unfortunately not what you're looking for. That just tells you the particular subtype of a MediaMetadata instance. If you want to check the type of a file, you should check its file extension. You can then compare the extension against the list of supported extensions for GetThumbnail.

View solution in original post

7 Replies 7
Highlighted

Re: Path for .NET SDK thumbnails

Dropboxer
Dropboxer

If you use BeginGetThumbnail, you'll need to also use EndGetThumbnail. The Begin method fires up an async operation and the End method blocks until it completes. That would look something like this:

 

var asyncResult = this.client.Files.BeginGetThumbnail (path);
// ...
var thumbnailResult = this.client.Files.EndGetThumbnail (asyncResult);

 

It shouldn't return null though, and it seems to be working for me. Can you share the code that's giving you trouble?

 

Alternatively, you can use just GetThumbnailAsync like this:

 

var thumbnailResult = await this.client.Files.GetThumbnailAsync(path);

 

Highlighted

Re: Path for .NET SDK thumbnails

Explorer | Level 3

Thanks for the info.  Got things going the right direction.  I thought I needed to used the EndGetThumb but wasn't sure where it fit in the puzzle.   On the topic of thumbs - is it possible to call all the thumb for files that are images in a folder or do I have step thru them . 

Thx

G

Highlighted

Re: Path for .NET SDK thumbnails

Dropboxer
Dropboxer

No, unfortunately the API doesn't offer a way to get thumbnails in bulk like that, but I'll be sure to pass this along as a feature request. You'll need to call for each one you need.

Highlighted

Re: Path for .NET SDK thumbnails

Explorer | Level 3

No problem.  Its easy enough to setup an asinc service, get a list and parse thru them.   2 more questions I ran into.

1.  Is Thumbnail size fixed??  I have changed the size in the request but they are always the same;

       "BeginGetThumbnail(item.PathLower, format.AsJpeg, size.AsW64h64)"

 

2.  How do I check if a file is a photo??  I thought this had promise but nope

      "Entries.Where(n=>n.AsFile.MediaInfo.AsMetadata.Value.IsPhoto))"

 

Thx

G


Highlighted

Re: Path for .NET SDK thumbnails

Dropboxer
Dropboxer

1. To set parameters like those, you should supply values like this:

  var asyncResult = this.client.Files.BeginGetThumbnail (path, Dropbox.Api.Files.ThumbnailFormat.Jpeg.Instance, Dropbox.Api.Files.ThumbnailSize.W64h64.Instance); 

2. That IsPhoto is unfortunately not what you're looking for. That just tells you the particular subtype of a MediaMetadata instance. If you want to check the type of a file, you should check its file extension. You can then compare the extension against the list of supported extensions for GetThumbnail.

View solution in original post

Highlighted

Re: Path for .NET SDK thumbnails

Explorer | Level 3
Thanks for the information.
Go kind of a feel for how this API is put together
don't seem to be many using the .NET
G
Highlighted

Re: Path for .NET SDK thumbnails

Dropboxer
Dropboxer
The Dropbox API now offers the ability to get thumbnails in batches. In the .NET SDK, that's available as:

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_GetThum...

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?