1
<?php
2
require_once('includes/sessions.php');
3
$strText = $_SESSION['imagecode'];
4
header ('Content-type: image/jpeg');
5
6
$imgImage = ImageCreate(440, 100);
7
$black = ImageColorAllocate($imgImage, 0, 0, 0);
8
ImageFill($imgImage, 0, 0, $black);
9
10
for ($i=0;$i<20;$i++)
11
{
12
	imageLine(
13
		$imgImage,
14
		rand(1,439),
15
		rand(1,99),
16
		rand(1,439),
17
		rand(1,99),
18
		ImageColorAllocate($imgImage, rand(50,100), rand(50,100), rand(50,100)));
19
}
20
21
$x = rand(20,220);
22
$y = rand(25,75);
23
$rot = rand(-40,40);
24
for ($i=0;$i<10;$i++)
25
{
26
$t = ($i-1 >=0 && ($strText[$i-1] == 'm' || $strText[$i-1] == 'w')) ? 4 : 0;
27
	imageTTFText(
28
		$imgImage,
29
		rand(23,24),
30
		$rot + rand(-10,10),
31
		$x+$i*20+$t,
32
		rand($y,$y+15),
33
		ImageColorAllocate($imgImage, rand(120,255), rand(120,255), rand(120,255)),
34
		'./fonts/Vera.ttf',
35
		$strText[$i]);
36
}
37
38
ImageJpeg($imgImage);
39
40
ImageDestroy($imgImage);
41
?>