Reputation: 275
I can't figure out at all how to create an ImageSource from a base64 string.
let source = new ImageSource();
source.fromBase64('b64strhere').then(..);
in this context the parameter passed in the following promise is a boolean which I don't know what's supposed to represent. The ImageSource afterwards is null both on android and iOS.
What am I missing here?
Upvotes: 1
Views: 1696
Reputation: 527
I load it and put in an Image element like this:
this.imageSource = new ImageSource();
var loadedBase64 = this.imageSource.loadFromBase64(MY_BASE_64_STRING_PREVIOUSLY_SAVED);
console.log(loadedBase64);
if (loadedBase64) {
let photo = <Image>this.photoImage.nativeElement;
photo.imageSource = this.imageSource;
this.photo = photo;
}
(NS 3.1)
Upvotes: 1