Created
August 2, 2017 14:15
-
-
Save matthieu-D/4ae83e3bea0d1077d7f53e087b0c5a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataURItoBlob(dataURI) { | |
// code adapted from: http://stackoverflow.com/questions/33486352/cant-upload-image-to-aws-s3-from-ionic-camera | |
let binary = atob(dataURI.split(',')[1]); | |
let array = []; | |
for (let i = 0; i < binary.length; i++) { | |
array.push(binary.charCodeAt(i)); | |
} | |
return new Blob([new Uint8Array(array)], {type: 'image/jpeg'}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment