Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Pasek TVP</title>
- </head>
- <body>
- <img id="template" src="template.jpg" width="800" height="426" style="display: none;">
- <input type="text" id="caption" value="" placeholder="Tekst">
- <button onclick="generateImage()">Generuj</button><br>
- <canvas id="canvas" width="800" height="426"></canvas>
- <script>
- function generateImage() {
- const c = document.getElementById("canvas");
- const ctx = c.getContext("2d");
- const img = document.getElementById("template");
- ctx.drawImage(img,0, 0);
- ctx.font = "26px Arial";
- ctx.fillStyle="#fff";
- const caption = document.getElementById("caption").value.toUpperCase();
- ctx.fillText(caption, 165, 382);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement