Uploading an image of a canvas to cloudinary

Hi!

I’m making a drawing app, and I have a share feature for the drawings. For that, I’ve tried
from Media-DB1 call upload image
media= image of canvas1. It wasn’t working, so I tried
if error-
from label1 set text to error.
It said
image
. What should I do?
Thanks,
@codeswept

The “image of canvas1” block returns a value in base64.

See this: Share / Save Canvas image?

Cloudinary does support base64 so you’d need to use the upload API to upload the text string generated by the “image of canvas1” block.

If you just want to share a screenshot with another person, I was able to share a screenshot of the canvas drawing via text message (Messages app on iPhone) using these blocks:

Thanks very much for this!

I wasn’t able to find the API key from the docs you shared. Where can I get one from?

I wasn’t able to find the API key from the docs you shared. Where can I get one from?

Your API key should be in your Cloudinary Dashboard.

I’m posting a curl command that works and then I’m going to see if I can get it to work using Thunkable blocks:

curl --location --request POST 'https://api.cloudinary.com/v1_1/[YOUR CLOUD NAME]/image/upload?upload_preset=rpcv1fz5' \
--header 'api_key: [YOUR API KEY]' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'file=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='

Granted, this is with an unsigned upload. I haven’t been able to get it to work with a signed (secure) upload.

When I use these blocks, I get “undefined” for the status. @drted Any ideas what I’m doing wrong with paremeters/headers? See the post above this for a working curl command.

Not sure. I’ve had a lot of problem getting the Query Parameters block to work consistently. Sometime I give up and put it in the URL :frowning:

@tatiang P.S. can you share a link to the documentation for the REST API command you are trying to use?

(This is @tatiang)

@drted I found their documentation confusing but it’s here: https://cloudinary.com/documentation/image_upload_api_reference

I think pages likes this are more useful: