Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49260

ImagePicker to Firebase Storage

$
0
0

Hello,

I’m trying to use the ImagePicker plugin from Cordova to send few pictures to my firebase storage. The problem is that I get a format error:

E/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 39108 - Msg: ERROR Error: Uncaught (in promise): FirebaseStorageError: {"code_":"storage/invalid-format","message_":"Firebase Storage: String does not match format 'base64': Invalid character '-' found: is it base64url encoded?","serverResponse_":null,"name_":"FirebaseError"}

I tried a lot of configurations that i found, but still not working.
My code is this one :

selectImages(){
        this.imagePicker.getPictures({
            maximumImagesCount: 10,
            width: 500,
            height: 500,
            quality: 80
        }).then((results) => {

            let userImages = [];

            results.forEach(result => {

                const post = 'photos/' + Date.now().toString() + result.name;

                console.log('debug result: ' + result);

                const storageRef = firebase.storage().ref(post).putString('data:image/jpg;base64,' + result, 'data_url');
                }
         }
    }

And I get this from the console log:

I/Capacitor/Console: File: http://localhost/pulser-pulser-module-es2015.js - Line 185 - Msg: debug result: file:///data/user/0/io.ionic.ceopulser/cache/tmp_Screenshot_20200908-181610_Instagram3847727537251182735.jpg

Do someone know how to fix this error, and make this work ?
Thanks in advance

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49260

Trending Articles



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