Hey, I need to store an image (object File) in order to use it on my app whenever I want. So I’m doing like this:
this.user = this.parse.currentUser;
this.photo = this.user.get('photo');
console.log(this.photo);
const blob = new Blob([this.photo], {type: 'image/jpg'});
const reader = new FileReader();
reader.onload = () => {
console.log(reader.result);
this.userPhoto = reader.result;
console.log(this.userPhoto);
};
reader.readAsDataURL(blob);
but when I try to display it on HTML like this:
<img src="{{userPhoto}}" class="avatar"
id="avatar"/>
It doesn’t show the image but an broken image, like this:
help please, I’m on this issue for a week now.
1 post - 1 participant