How to convert images to base64

I would like to convert an image file to base64 after taking a picture to use the OCR function. Is there a plugin or API to do that? If not, I am thinking of using n8n to convert from image files to base64.

Id look at using AWS Lambda for this, image processing is the perfect use case for this.

A quick search gave this result.

Thank you so much. You guys have helped me figure this out!

Hi, guys.

I am also using File URL to Base64 plugin to convert image gotten through Bubble file uploader. I am hitting a roadblock because after calling it on the workflow, I don’t receive back the base64 data.

I have also tried the second option of uploading to Bubble first but still could not find how to access the data. How do I go about this?

@jidoca.engineer any ideas on how you implemented yours might just help us. Thanks guys

1 Like

Anyone figure this out?

With this plugin, it exposes its own action for when the file is generated. So first you will need to use the action “File to Base 64”, then create the exposed event “A file to base 64 File URL is generated” and use the exposed base64File in this event and you will get the correct code

1 Like

Correct me if I’m wrong, but this plugin is doing the work on clientside only, so there’s no way to integrate it into Backend Workflows, right?

I made this conclusion because of a review saying about client-side processing, and also because there’s no any action for this in backend workflows.

“Bubble Back End Utilities” plugin use the “Read to Base64” action

1 Like

Thank you so much! It really have (for ancestors - it’s called Read to Base64).
Maybe you can advice how I can write it down to bubble data? I mean what type of data should be passed into make changes to thing? It’s definitely not an image as it puts everything to the url and it appears like https://bubble.io/"iVBORw0KGgoAAAANS…

image
Here’s how it appeared to me. But obv it’s not right

1 Like

What do you mean by “Write it down to Bubble data”? Typically you would convert a file to Base64 so you can send the contents to an external service or something. It should just output the Base64 string (the literal contents of the file in Base64 format)

1 Like

I’m talking based on this Instruction:
https://manual.bubble.io/core-resources/api/the-bubble-api#sending-data

  1. Files and Images: When a parameter is a file or image, you have two ways to define the content in the request. You can submit a string, which should be the URL of the file/image hosted on a storage service, or you can provide the raw data and the API call will upload the content to Bubble’s hosting services. In the later case, the value provided should be a JSON object as follows:
    {
    filename: String
    contents: Base64-encoded binary data
    private: Boolean
    attach_to: String
    }

My case:
I have API Workflow that receives id and image url. I want to store this image in database rather than having a link to it that initially received. So I assumed that I have to convert it to base64 to upload it to bubble data servers. Am I right?

Field’s type is image in Database. And I receive jpgs or pngs only.

Oh I see now… try doing Image = [your image URL]:saved to S3

1 Like

Oh my that was THAT simple!
Thank you a lot! If you have buymeacoffee - let me know :slight_smile:

1 Like

I believe bubble exposes its own :encode to base64 action on the backend which you should be able to use for files and images

1 Like