πŸ–Ό Base64 Tools - five little ones ;)

Your extensions work excellent, thanks a lot.
Just a question, I'm trying to save this image files to Google Drive, but when I save them, they have 50-60 Kb, so small. It could be because the compression or maybe I need to change my Google Script?

How did you do ? show us your relevant blocks.

The Google Script is:

function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.filename);
DriveApp.getFolderById('1yCfyDVIy8bY8B').createFile(blob);
return ContentService.createTextOutput("Your File Successfully Uploaded");
}

because you are calling TakeThumbnailPicture? Thumbnail normaly very small.
Try with Camera.TakePicture, then get base64 of the picture, then send to googe drive.

1 Like


It worked, thanks a lot!

Hello.
I would like some help on how to convert Canvas to Base64. I've tried many variations (ANKE, TIMAI etc...) but it doesn't work.
I would like to upload the image converted into a string to firebase.
Everything works, but the saved data gets the value ("File not found.").
image

My Android version is 12, API 31.

Just use:

Canvas to Base64

no need to create a file

Thanks for the quick response.
Yes, that's what I started with. CameraBase64 works perfectly, the received string is also added to firebase. Unfortunately, what I would need is to convert a modified image (canvas) and not a camera captured image. The installed extensions:
image
Here is your suggested test and the error message at runtime. (All direct canvas conversions give the same error)
4
5
3

Just tested, and you are correct, it throws that error. Not sure what has changed to make this happen....will need to do some testing.

This part doesn't throw an error, but I don't know where exactly it saves the file. Maybe it doesn't even save? Or have the libraries been changed again in the newer android version?
7

Of course, it would be better if the direct conversion worked...

Usually in the ASD... also depending on how you set the default file scope in the Screen1 properties...

Taifun

DefaultFileScope = "App". I guess that's okay.
Maybe it could be "Shared"?

In a last post, Anke wrote:

Should I enable readout (Image)?

I tried to enable it, but it gives me this error:
9

Now fixed, download extension again, and restart companion, and try again. You may find it a bit slow with complex images, so perhaps use the progress dialog or similar....

Canvas to Base64

All credits to @Kumaraswamy for his quick response and fix :slight_smile:

1 Like

Thank you very much. I will try it soon and give feedback. Have a good day.

Thank you very much for your very quick response. It works perfectly fine. There is no problem with "a little slowness", as I have options to avoid this observation. It does its job. I wish I knew how and how you do this.

The code is provided above in the first post

5 posts were split to a new topic: Canvas Bug - Image Reload hides arrangements

Update

Now added a fifth "little one", Base64Convertor.

This will convert a binary file to a base64 string, and convert a suitable base64 string to a binary file.

You will have to set absolute paths (possibly full paths in some circumstances) to the files...

You can download this extension from the first post in this topic.

2 Likes