JSFiddle - React, Tailwind, and code Playground
HTML
<?php
// Unsere Zeichen in einem Array
$text[0] = "H";
$text[1] = "S";
$text[2] = "L";
$text[3] = "8";
$text[4] = "U";
Header ("Content-type: image/png");
// Laden der Rohdatei, die sich im Verzeichnis befinden muss
$bild = ImageCreateFromPNG ("captcha-clock.png");
// Farben definieren
$farbe_w = ImageColorAllocate ($bild, 255, 255, 255);
$farbe_b = ImageColorAllocate ($bild, 0, 0, 0);
// die verwendete Schrift-Datei arial.ttf muss vorhanden sein
// Aufbau:
// Schriftgröße, Winkel, X-Pos., Y-Pos, Farbe, Schrift, Inhalt
ImageTTFText ($bild, 32, -30, 140, 70, $farbe_b, "vera.ttf",
$text[0]);
ImageTTFText ($bild, 32, -90, 180, 130, $farbe_b, "vera.ttf",
$text[1]);
ImageTTFText ($bild, 32, 0, 130, 210, $farbe_b, "vera.ttf",
$text[2]);
ImageTTFText ($bild, 32, 45, 80, 190, $farbe_b, "vera.ttf",
$text[3]);
ImageTTFText ($bild, 32, 99, 80, 120, $farbe_b, "vera.ttf",
$text[4]);
// Ausgabe im Format PNG
imagepng($bild, null, 9);
// Resourcen wieder freigeben
ImageDestroy ($bild);
?>
<title>Test a Captcha</title>
<form action="validate.php" method="post"> <!-- kein < />, denn es kommt ein schliessender Tag -->
<div>
<img src="captcha.php" alt="Captcha" width="128" height="128" /> <!-- HIER brauchst du das < /> -->
</div>
<input type="text" name="verification" size="5" maxlength="5" />
</label><br />
<input type="submit" name="submit" value="Captcha lösen" />
</form>