Skip to content

Instantly share code, notes, and snippets.

@icaroharry
Created August 1, 2016 16:43
Show Gist options
  • Save icaroharry/0f95010e9dd6570611c00286a231e0c4 to your computer and use it in GitHub Desktop.
Save icaroharry/0f95010e9dd6570611c00286a231e0c4 to your computer and use it in GitHub Desktop.
I've already tried different ways to construct the blob and the base64 binary, but none of them worked.
dropbox.getThumbnail(file.path_lower, 'jpeg', 'w64h64').
then((response) => {
console.log(response)
//let thumbnailBlob = window.btoa(unescape(encodeURIComponent(response.text)));
//file.thumbnailLink = 'data:image/jpeg;base64,' + thumbnailBlob;
let arrayBufferView = new Uint32Array(response.text);
let thumbnailBlob = new Blob([arrayBufferView], {type: "image/jpeg"});
file.thumbnailLink = window.URL.createObjectURL(thumbnailBlob);
console.log(thumbnailBlob);
console.log(file.thumbnailLink)
}, (err) => reject(err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment