1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?php
session_start();
$string = strtoupper(substr(str_shuffle('acdefghijklmnpwyz2345679'), 0, 5));
$_SESSION['key'] = $string;
$image = imagecreatefromjpeg("images/box6.jpg");
for($i=1; $i<=rand(30, 70); $i++) { // lines
$lines = imagecolorallocate($image, rand(180, 200),rand(180, 210),rand(160, 200));
imageline($image,rand(1, 90),rand(1, 35),rand(10, 150),rand(1, 40),$lines);
}
for ($i = 0; $i <= rand(300, 600); $i++) { // points
$point_color = imagecolorallocate ($image, rand(0,255), rand(0,255), rand(0,255));
imagesetpixel($image, rand(1,128), rand(1,38), $point_color);
}
$angle = rand(-3, 3);
$x = rand(4, 44);
$y = rand(20, 30);
$color = imagecolorallocate($image, 145, 145, 145);
$font = 'images/REFSAN.TTF';
imagettftext($image, 16, $angle, $x, $y, $color, $font, $string);
header("Content-type: image/jpeg");
header('Cache-control: no-cache');
imagejpeg($image);
?> |
Partager