ImagePicker to Firebase Storage


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 :

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

            let userImages = [];

            results.forEach(result => {

                const post = 'photos/' + +;

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

                const storageRef ='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

IMHO, that plugin is a dumpster fire. I would look for any alternative you can find. I believe @EinfachHans wrote a replacement recently.

1 Like

Ahah okay i believe you so, actually i tried to use the camera plugin, but it was not possible to select few images at once, that s why i came to use imagePicker

That makes sense. I haven’t used it, but here seems to be the @EinfachHans one.

1 Like

Yeah I just found it, I’m gonna try and I’ll let you know

Thanks @rapropos :blush:

@samuelv If you habe any problems - feel free to open an Issue in Github