Set image via base64 string

What I’m trying to do: I’m trying to use a base64 string to set an image.

What I’ve tried and what’s not working: I’ve tried using anvil’s BlobMedia class to set an image from the base64 string. I’ve tried converting this to binary before placing it into blobmedia.

I’m on my phone but I would be willing to post examples of what I’ve tried (if needed) when I have access to my computer. I’m new to anvil and would appreciate a little help or an example if anyone has one :slight_smile: thank you!

Code Sample:

# code snippet

Clone link:
share a copy of your app

Sometimes, the most simple way is the correct way. A clone link would have definitely helped but if you set the source of Image to that base 64 string, it should work right away.

In the designer, you can click on the image, go to its source, click on the upload button and upload your file. It will be automatically converted to base64 string. In the editor, you will have to set it like this

self.image_1.source="<your base64 encoded string>"

Perfect, thank you for the advice! I’ll have to try this out soon!

1 Like