How to save an image in a (stored) variable?

Hi,

We have a simple page to edit a “book” on which there is a button “Change Cover”. When clicked, we want to allow the user to select a photo on the phone and set the image’s picture to that photo.

Here are our blocks:

However, at the moment, it seems that our stored variable “cover_image” does not properly saves the picture. When clicking back and then re-opening the page, the image’s picture is not properly loaded from the variable. Weirdly enough, it works when doing the exact same thing on the label’s text value, but we can’t make it work for an image.

Any idea on what is going wrong?

You need to store the image outside of Thunkable. This is usually done with Cloudinary. So you upload/host the image on Cloudinary and then access the url in Thunkable to display the image. The green “Photo” block should have the url so all you need to do is set your stored variable to that value.

2 Likes

Right, putting the variable-set inside the “then do” block and using “photo” rather than “Cover_image’s picture” worked. Thanks!

1 Like

hello,

We cannot save the photo directly in the stored variable ? I do not want to use the cloud. I imagine that we can encode the image but I thougth we could use the stored variable and the media library.
Any tips on this ?

There’s a new base64 converter block in the Camera & Media drawer. I haven’t used it but I think you could convert and store the value in a variable.

3 Likes

thanks I did not see it.
I will try now and let you know

1 Like

See the red arrow

I do not have the block.
Maybe it is not officially released yet ?

1 Like

This block is only available in the DnD UI. It is not available in the StP (old or legacy) UI.

1 Like

This block is not part of my drag and drop Camera & Media drawer.

2 Likes

I do not have this either.

1 Like

Yes, @tatiang, the block was removed from the drawer. Not just that, Thunkable removed the announcement of this block from the Release Notes in their documentation.

[Edit]
I just tested a code that I have using this block in an old project
image

The code does not work anymore.

Thanks for the clarification. I was wondering about that.

2 Likes