-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsecpic.php
53 lines (44 loc) · 1.58 KB
/
secpic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php session_start();
$width = 100;
$height = 60;
$font_size = 17.5;
$let_amount = 4;
$fon_let_amount = 30;
$path_fonts = 'fonts/';
$letters = array('a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z','2','3','4','5','6','7','9');
$colors = array('10','30','50','70','90','110','130','150','170','190','210');
$src = imagecreatetruecolor($width,$height);
$fon = imagecolorallocate($src,84,151,196);
imagefill($src,0,0,$fon);
$fonts = array();
$dir=opendir($path_fonts);
while($fontName = readdir($dir))
{
if($fontName != "." && $fontName != "..")
{
$fonts[] = $fontName;
}
}
closedir($dir);
for($i=0;$i<$fon_let_amount;$i++)
{
$color = imagecolorallocatealpha($src,rand(0,255),rand(0,255),rand(0,255),100);
$font = $path_fonts.$fonts[rand(0,sizeof($fonts)-1)];
$letter = $letters[rand(0,sizeof($letters)-1)];
$size = rand($font_size-2,$font_size+2);
imagettftext($src,$size,rand(0,45),rand($width*0.1,$width-$width*0.1),rand($height*0.2,$height),$color,$font,$letter);
}
for($i=0;$i<$let_amount;$i++)
{
$color = imagecolorallocatealpha($src,rand(27, 37),rand(59, 69),rand(80, 90), 0);
$font = $path_fonts.$fonts[rand(0,sizeof($fonts)-1)];
$letter = $letters[rand(0,sizeof($letters)-1)];
$size = rand($font_size*2.1-2,$font_size*2.1+2);
$x = ($i+1)*$font_size + rand(4,7);
$y = (($height*2)/3) + rand(0,5);
$cod[] = $letter;
imagettftext($src,$size,rand(0,15),$x,$y,$color,$font,$letter);
}
$_SESSION['secpic'] = implode('',$cod);
header ("Content-type: image/gif");
imagegif($src);