Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Base64 image doesn't display

$
0
0

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:

image

help please, I’m on this issue for a week now.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>