I want to save an image to Firebase storage.
I have a JS function that does that, however I cannot get the media object from Python to JS.
Also I don’t want to go to the server, since it should be as fast as possible.
I’ve tried to send the Media Object as js_call function parameter -> didn’t work
Could you provide a bit more context (perhaps a clone link for an app? Don’t worry, the Secrets are cleared when the app is cloned, so your Firebase keys are safe ).
In particular, it looks like this error is occurring in side your save_img() function in Javascript, but you haven’t provided the code for that function, so it’s rather difficult to see what’s going wrong!
The connection works fine if you presss the button “upload” on the sample app it does create a file with the correct filename.
However the file is some strange octet-stream with just 9Byte
I think the problem is that although i pass the image onto the js function it is not serialized into something that firebase can work with.
As I mentioned, I tried to convert it to a base 64 but couldnt get it to work.
(I could of course just send it to the server and store it from there with a python library but then I’d lose the serverless Architecture as well as some performance)
Above I tried to use your code to convert an image to a base 64 String Client Side.
I found out that your Clone link on the post above works fine for python2, however it breaks when switching to python 3. Can you reproduce the issue?
I cannot find anything different for the base 64 library on pyhton3 so i guess I’m either on the wrong path entirely or maybe there is something wrong with the base 64 Lib on Skulpt?