<?php
session_start();
header("Content-type: image/jpeg");
$znak1 = rand(0,9);
$znak2 = rand(0,9);
$znak3 = rand(0,9);
$znak4 = rand(0,9);
$znak5 = rand(0,9);
$_SESSION['captcha']=$znak1.$znak2.$znak3.$znak4.$znak5;
$podklad = imagecreatefromjpeg("cesta k podkladovemu obrazku");
$farba_textu = imagecolorallocate($podklad, mt_rand(0, 250),mt_rand(0, 250),mt_rand(0, 250));
ImageTTFText($podklad, mt_rand(25,30), mt_rand(-40, 40), 10, 40, $farba_textu, "cesta k fontu/font.tff", $znak1);
$farba_textu = imagecolorallocate($podklad, mt_rand(0, 250),mt_rand(0, 250),mt_rand(0, 250));
ImageTTFText($podklad, mt_rand(25,30), mt_rand(-40, 40), 60, 40, $farba_textu, "cesta k fontu/font.tff", $znak2);
$farba_textu = imagecolorallocate($podklad, mt_rand(0, 250),mt_rand(0, 250),mt_rand(0, 250));
ImageTTFText($podklad, mt_rand(25,30), mt_rand(-40, 40), 100, 40, $farba_textu, "cesta k fontu/font.tff", $znak3);
$farba_textu = imagecolorallocate($podklad, mt_rand(0, 250),mt_rand(0, 250),mt_rand(0, 250));
ImageTTFText($podklad, mt_rand(25,30), mt_rand(-40, 40), 150, 40, $farba_textu, "cesta k fontu/font.tff", $znak4);
$farba_textu = imagecolorallocate($podklad, mt_rand(0, 250),mt_rand(0, 250),mt_rand(0, 250));
ImageTTFText($podklad, mt_rand(25,30), mt_rand(-40, 40), 190, 40, $farba_textu, "cesta k fontu/font.tff", $znak5);
imagecopy($podklad, $podklad, 0, 0, 0, 0, 250, 50);
imagejpeg($podklad);
?>
$farba_textu = imagecolorallocate($podklad, mt_rand(0,
250),mt_rand(0, 250),mt_rand(0, 250));
$farba_textu = imagecolorallocate($podklad, 0,0,0);
Pridať komentár k článku