Created
July 26, 2016 13:05
-
-
Save m5rk/d8747b8be7c6187f600781c7bdb27fab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// When Cordova is not present Camera.getPicture() will throw an exception. | |
// Catch that and use your fixture image... | |
public takePicture(): void { | |
Camera.getPicture(options) | |
.then((data) => { | |
let base64Image: string = 'data:image/jpeg;base64,' + data; | |
this.save(base64Image); | |
}) | |
.catch(() => { | |
// openssl base64 -in small.png -out small.txt | |
let base64Image: string = `data:image/png;base64,' + contents of small.txt | |
this.save(base64Image); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment