Get image data in base64 format

Goal: I have a column with image column type. When I upload image to that column I want it to be stored in google cloud storage. For this I need image data in Base64 format. How can I get this?

I am storing it the Postgres database that I am using as a ultimate destination for all the data coming in from retool app. I have set up GCS bucket and resource on retool as well. when I am trying to upload an image , for testing purpose I am inserting image as a string in postgres but that string looks like "https://myorg.retool.com/9j/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0V.." . So the image is not in base64 format here. I guess if somehow I could transform this into base64 then eventually I will be able to upload these screenshots to GCS bucket.

How can I get or transform image in Base64 format?

Hello!

I believe you can access the base64 data from the column as noted in this thread:

When I look at the state of a table with the image column and an uploaded image (unsaved) I see the following in the changesetArray/Object:

image

image was the id of the column I created.

u could use fetch to get the image from the url i believe. bout to board a plane or id double check for ya

1 Like

@pyrrho's approach should do it but here is a REST Api to get the image with the URL if you would like to go that route:


Note: We can then use that base64Data.

Just can set your domain as the base URL when configuring the resource:

And add set the rest of the url dynamically if you want to reuse the query:

2 Likes