Hi , I am comparatively new to web api’s post method So has anyone had success with making an image using an api which requires the POST method?
I’ve found POST blocks to be really difficult to use. But it’s not clear what you’re wanting. “Making an image” could mean anything from ASCII art to uploading a photo from a phone’s album to drawing on the canvas with your finger. Can you be more specific?
What i want is to generate an image and show it to the user For example : Using the text hi And converting it to an image. I found a
few services that do this with the POST method but , yes , it is tough
Just as a workaround I used electronic signature in one of my apps and made use of the canvas for the user to “draw” the signature and then I store the canvas image to a stored variable to be retrieved anytime the signature is required. It works ok with me.
I’m sure @overturner is asking for a different subject but I thought of sharing the experience.
Hi any idea on how to do this
I know how to draw on JavaScript canvas
See this html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Letter to Image</title>
<style>
canvas{
border: 1px black solid;
}
#textCanvas{
display: none;
}
</style>
</head>
<body>
<canvas id='textCanvas'width="300" height="300"></canvas>
<img id='image' >
<br>
<script>
var canvasTx = document.getElementById('textCanvas').getContext('2d');
var imageChar = document.getElementById('image');
canvasTx.fillStyle = 'green';
canvasTx.font ='48px Brush Script MT, cursive';
canvasTx.fillText("Hi Overturner", 10, 50);
imageChar.src = canvasTx.canvas.toDataURL();
</script>
</body>
</html>
Thanks , i will try this , didnt think of it
That’s a great idea to use the canvas for electronic signatures!
I don’t know of a way to convert text to an image but you’re right, there’s probably an API that does that. What would you use this for?
Check my html file.
It should give an image like this
The idea is to have it in a Web Viewer Extension
and what ever text you pass it it should return a Base64 URL which you can have at as the URL for an image in your screen.
Hi , i am not able to use the web viewer extension in this( i have used it before), can you give a sample code of that.
Use this. Gives the same result but as a Thunkable project without extensions. The only difference is the choice of font.
ok , so i wanted is for the WDC.
I need to make a receipt for the person who buys something , and then send in the mail. As receipts are always images , i used this method. Now , when i try to share the imge of the canvas , it comes as a link in the phones and in the web app it shows very long request
That was not in your original post but in JavaScript it is always possible and if your email client supports HTML then it should render the image from the long string.
Ok thank you
Sorry