Guten Morgen,
kann ich eine Zahl wie z. B. 345 oder 45345 per code in ein Image umwandeln?
<img class="vorschau" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAMAAAExAAIAAAARAAAATgAAAAAAAJOjAAAD6AAAk6MAAAPocGFpbnQubmV0IDQuMC4xOQAA/9sAQwACAQECAQECAgICAgICAgMFAwMDAwMGBAQDBQcGBwcHBgcHCAkLCQgICggHBwoNCgoLDAwMDAcJDg8NDA4LDAwM/9sAQwECAgIDAwMGAwMGDAgHCAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAPABQAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A/fyiiigAooooAKKKKACiiigAooooAKKK8v8AH/x41m2+JWoeD/CPh2LUtX0XTYtX1K81qa50vSoIJGdY1juhbypLKfLkyq4CAZYjpUykoq7OjC4aeIqqjBpN92or5uTSX367LU9Qorxm0/axm8VfDXwFqXh/w/Hca/8AEKKSazsL7URbWtlHCm6eaW4VHJiT5QGRCX8xMAZ4sePvjn4y8BL4F0mTwz4XuPFfjO9urQxf2/NHptsIIJZ94nNqXbfHHwPKGGbGT1rH61TtdPt0fW1vzR7f+qeZe0VGUFGTc1Zzgn+75ud6y+GPJJOXw3Vk2z16is3wjc6teeHLWTXbPT7DVmB+0W9ldNdW8Z3HAWRo42b5cHJReSR7nSrdO6ufP1KbhNwdrp20aa07NaNea0YUUUUyAooooAK8v/aa0C18Y6HZaTq3wzvviRoszNLJDaXNrG1rMoxGSs80WVO5vmVjtxnHQj1CioqU1OPK/wBP1ud2W46WCxMcVBXcdVrKOvdOEoyTW6s192h8sS/s0+IF8G/Ce+8XeE/+FjP4OTVbPUNCubm1vJ0truRWtvmuWSCd7dIYY2LMMn5hkgGtvwr8IH8HfCDTtJ8TfCGPxtZ3Wr6lqFpocf8AZt4vhWKaYtb2y/apUjwI2IJiYqhBAyuDX0ZRXNHAwTum9rdPJdvI+prceY+tBU6kY2UpSSTqRs5SqSsuWa5UpVJNONpWsnJq6fnP7Knw31T4U/Bu10nVYxZzfbby6h09bj7Qmk28tzJJDaLJ/EIo2VcjjggcAV6NRRXTTgoRUFsj5TMcdUxuKqYytbmqScnba7d3bd/e2+7bCiiirOMKKKKACiiigAooooAKKKKACiiigAooooA//9kA" alt="Bild wie User es gerne hätte">
<br>
Wenn ich z.B. die Zahl 345 habe, möchte ich ein Image erstellen, das die Zahl 345 anzeigt, als Inhalt hat
<span style="color:#d30909">Lösung von @sempervivum</span>
Code
<script src="/js_webseite/jquery.js"></script>
<script src="/js_webseite/jcanvas.js"></script>
<body>
</body>
<script>
var nrimg = 4;
var maxnr = 500;
function makeRandomImages() {
for (var i = 0; i < nrimg; i++) {
var canvas = $("<canvas></canvas>");
canvas.attr({width: "100", height: "50"});
$("body").append(canvas);
var rndnr = Math.floor(Math.random() * maxnr);
canvas.drawText({
fillStyle: '#9cf',
strokeStyle: '#25a',
strokeWidth: 2,
x: 50, y: 25,
fontSize: 48,
fontFamily: 'Verdana, sans-serif',
text: rndnr
});
}
}
makeRandomImages();
</script>