Uploading an image of a canvas to cloudinary

i have a question why use cloudinary when you have base64?

1 Like

I’m sorry, I don’t get you?

So this is a long shot but you might be able to upload the base64 text string and convert it to an image url using this:

https://codebeautify.org/base64-to-image-converter?input=

If you add your base64 string after the equals sign, it should return an image.

1 Like

Wow, that is cool! Is that a web viewer URL or an API?

Good question. I’m fairly certain it will work as an API. When I tested it, though, it complained the header was too long. That site works fine if you paste base64 into it… just not sure it works as a long url in a browser on in Thunkable.

My test string was 266,836 chars long! :confounded:

1 Like

Yeah, I just tried it by pasting my Base64 URL along with that in Google, and this is what I got:
image

Haha, mine was 100148…

That site is one my favorites for API/JSON viewing but they don’t seem to have an API as far as I can tell.

1 Like

I use that site too for JSON… re all base64 urls that long or could we find a shorter one for testing?

Argh. Do you have any other ideas on how I can send my canvas to the Open OCR API?

Well, my thought was to find an API that will convert from base64 to image and then get the image url and feed it into your OCR API. There may be other APIs that will do that conversion.

1 Like

I’ve been searching, I can’t find a thing.

@codeswept
Just to follow up. I was mistaken about the Google sheet workaround. You cannot fit a too long string in a single cell in Google sheet.

1 Like

I looked at this @tatiang but I haven’t ever worked with POST calls, only GET calls… @drted did you have any success with this?

I actually have one more idea. I found an API that takes HTML and another reference that says you can upload base64 within an tag. It’s complicated but if Thunkable ever works again :grimacing: I can try it and let you know.

1 Like

Thunkable still working for me thankfully.


A fully qualified url is required, does the data:image/ link count as that? If I try to put that sort of link in an image component it doesn’t work 97% of time.

You need to embed the base64 string inside an img src tag and then upload it to the API as html.

It will look something like this:

<img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6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AN+jAK3gEd+AlGMGIBFDgFvzouK3JV/lihQTOwLtOtw9wIRG5pJn91Tbgqk9kSk7GViADrTD4HCyZ0NQnomi51sb0fUyCMQEbp2WpU67IjfNjwcYyoUDhjJVcZBjYBy40j4wXgaobWoe8Z6Y80CJBwFpunepIzt2AUgFjtXXshNXjVmMh+K+zzp/CMs0CqeuzrxSRpbOKfdCkiMTS1VBQ41uxMyQR2qbrXiiwYN3ACh1FDmsdK2Eu4J6Tlo31dYVtCY88h5ELZIJJ+IRMzBHfyJINrigNkt5VsRiub9nXICdsYyVd2NcVvA3ScE5t2rb5JuEeyZnAhmLt9NK63vX1O5Pe8XaPSuGq1uTrfUgMEp9EJ+CQvr+BJ/AAKvAcCiAR+bf9CjAAluzmdX4AEIIAAAAASUVORK5CYII=">
2 Likes

Interesting. Let me check it out. As I said, I have 0 experience with POST commands, but I’ll try it out now.

What will I be required to fill out in the url parameter, then?