Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set("display_errors", "1");
- error_reporting(E_ALL);
- //Set the content type
- header('content-type: image/png');
- //Create our basic image stream 300x300 pixels
- $image = imagecreate(440,100);
- $back=imagecolorallocate($image,240,240,240);
- $color=imagecolorallocate($image,rand(0,200),rand(0,200),rand(0,200));
- $font_list=array('advent_light.ttf','BRADHITC.TTF','HARNGTON.TTF', 'JOKERMAN.TTF', 'RosewoodStd-Regular.otf', 'ITCEDSCR.TTF');
- $font=$font_list[rand(0,count($font_list)-1)];
- if($_SERVER['HTTP_HOST']!='127.0.0.1')
- {
- $fontpath = realpath('./font/');
- putenv('GDFONTPATH='.$fontpath);
- }
- $captcha='I LOVE YOU PUE';
- for($i=0; $i<count($captcha); $i++)
- {
- if(rand(0,1000000) %2 == 0)
- {
- $captcha[$i] = strtolower($captcha[$i]);
- }
- }
- $str_pos=imagettfbbox(30,0,$font,$captcha);
- $x=(400-$str_pos[2])/2;
- $y=75;
- $i=strlen($captcha);
- $len_minus=$i-1;
- while($i--)
- {
- $ch=$captcha[$len_minus-$i];
- imagettftext($image,30,(rand(0,100)>50?1:-1)*rand(0,25),$x,$y,imagecolorallocate($image,rand(0,200),rand(0,200),rand(0,200)),$font_list[rand(0,count($font_list)-1)],$ch);
- $x=$x+25;
- }
- imagepng($image);
- imagedestroy($image);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement