| Вот вам случайную картинку!
<?php
session_start();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", 10000)." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0",false);
header("Pragma: no-cache");
$width=200;
$height=40;
$letters=$_SESSION['gen_pict'];
$sign=strlen($letters);
$figures=array('70','90','110','130','150','170','190','210','230');
$c=count($figures);
$loopmg=imagecreatetruecolor($width,$height);
$fon=imagecolorallocate($loopmg,0,0,0);
imagefill($loopmg,0,0,$fon);
for($loop1=0;$loop1<$width;$loop1++){
for($loop=0;$loop<($height*$width)/1000;$loop++);{
$color=imagecolorallocatealpha($loopmg,$figures[rand(0,count($figures)-1)],
$figures[rand(0,count($figures)-1)],
$figures[rand(0,count($figures)-1)],rand(10,30));
imagesetpixel($loopmg,rand(0,$width),rand(0,$height),$color);
}
}
for($loop=0;$loop<$sign;$loop++){
$h=1;
$r=$figures[rand(0,count($figures)-1)];
$g=$figures[rand(0,count($figures)-1)];
$b=$figures[rand(0,count($figures)-1)];
$color=imagecolorallocatealpha($loopmg,$r,
$g,
$b,rand(10,30));
$letter=$letters[$loop];
if (empty($x))
$x=$width*0.08;
else{
if (!empty($xx))
$x=$xx;
else{
$x_offset=($width*0.8)/$sign+rand(0,$width*0.01);
$x=$x+$x_offset;
}
}
if (!empty($yy))
$y=$yy;
else{
if ($h==rand(1,2))
$y=(($height*1)/4)+rand(0,$height*0.1);
else
$y=(($height*1)/4)-rand(0,$height*0.1);
}
imagestring($loopmg,6,$x,$y,$letter,$color);
$x_offset=($width*0.8)/$sign+rand(0,$width*0.01);
$xx=$x+$x_offset;
if ($h==rand(1,2))
$yy=(($height*1)/4)+rand(0,$height*0.1);
else
$yy=(($height*1)/4)-rand(0,$height*0.1);
$thick=rand(1,4);
imagesetthickness($loopmg,$thick);
$ww=imagefontwidth(4);
$hh=imagefontheight(4);
if (is_integer($loop/2)){
imageline($loopmg,$x,$y,$x+$ww,$y,$color);
if (!($loop+1==$sign))
imageline($loopmg,$x+$ww,$y,$xx,$yy+$hh,$color);
}
else{
imageline($loopmg,$x,$y+$hh,$x+$ww,$y+$hh,$color);
if (!($loop+1==$sign))
imageline($loopmg,$x+$ww,$y+$hh,$xx,$yy,$color);
}
if (!is_integer($loop/2)){
imageline($loopmg,$x,$y,$x+$ww,$y,$color);
if (!($loop+1==$sign))
imageline($loopmg,$x+$ww,$y,$xx,$yy+$hh,$color);
}
else{
imageline($loopmg,$x,$y+$hh,$x+$ww,$y+$hh,$color);
if (!($loop+1==$sign))
imageline($loopmg,$x+$ww,$y+$hh,$xx,$yy,$color);
}
}
for ($loop1=0;$loop1<$width;$loop1++){
for($loop=0;$loop<($height*$width)/1000;$loop++);{
$color=imagecolorallocatealpha($loopmg,$figures[rand(0,count($figures)-1)],
$figures[rand(0,count($figures)-1)],
$figures[rand(0,count($figures)-1)],rand(10,30));
imagesetpixel($loopmg,rand(0,$width),rand(0,$height),$color);
}
}
header("Content-type: image/jpeg");
imagejpeg($loopmg);
imagedestroy($loopmg);
?>
|
Надеюсь терь поможете? | |