cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 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: 
Highlighted

thumb nail using swifty dropbox

Collaborator | Level 8
curl -X POST https://content.dropboxapi.com/2/files/get_thumbnail     --header "Authorization: Bearer ab-X"     --header "Dropbox-API-Arg: {\"path\": \"/nature.jpg\",\"format\": \"jpeg\",\"size\": \"w64h64\"}" > nat.jpg

The code/command line above works .. I get a thumb nail... but this code below using Swifty dropbox same image... I get an error...

func files_download_thumbV3(sourcePath: String) {
    print("sourcePath \(sourcePath)")    theApp.isNetworkActivityIndicatorVisible = true
    let client = DropboxClientsManager.authorizedClient!    _ = client.files.getThumbnail(path: sourcePath, format: .png, size: .w32h32)
        .response { response, error in
            self.theApp.isNetworkActivityIndicatorVisible = false
            if let response = response {
                let responseMetadata = response.0
                print(responseMetadata)
                let fileContents = response.1
            } else if let error = error {
                print(error)
            }
        }
        .progress { progressData in
            //print("files_download_thumbV2 \(progressData)")
    }

}
The error message... ".tag" = "unsupported_image" what am I doing wrong in the swifty dropbox code?



 

2 Replies 2
Highlighted

Re: thumb nail using swifty dropbox

Dropboxer
Dropboxer

Hi Mark, the unsupported_image logic happens on the server, so the client itself shouldn't make a difference. It looks like you are using different format and size parameter values between the two though. Can you try mtaching those to see if that makes a difference?

 

Otherwise, are you sure it's using the same app, account, and path as the curl command?

Highlighted

Re: thumb nail using swifty dropbox

Collaborator | Level 8

Hi Greg,

 

Sorry about the tardy reply. Looked again at this over the weekend, and think I found the answer. The error message it would seem is linked to the size of the image file. It appears the HTTP interface either handles this differently or can handle larger images. Will continue testing tonight and try and come back with some more definative findings with different size images/resolutions.

 

Thanks again for your help

Mark

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

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?