海の心配の時間...またはCAPTCHA 4D

すでに3Dキャプチャに関するトピックを書いたように

 ! :)

そして昨日、私はそれを少しやり直し、フリルともう1つの測定値を追加することにしました。

長いおとぎ話が書かれていますが、すぐにそれが完了し、私はそれをして、カプチュ4D ハイパーキューブを破壊しました。



いくつかの例:

image

image

コードも添付されています。

  1. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  2. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  3. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  4. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  5. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  6. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  7. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  8. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  9. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  10. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  11. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  12. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  13. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  14. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  15. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  16. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  17. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  18. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  19. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  20. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  21. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  22. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  23. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  24. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  25. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  26. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  27. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  28. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  29. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  30. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  31. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  32. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  33. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  34. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  35. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  36. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  37. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  38. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  39. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  40. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  41. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  42. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  43. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  44. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  45. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  46. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  47. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  48. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  49. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  50. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  51. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  52. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  53. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  54. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  55. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  56. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  57. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  58. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  59. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  60. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  61. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  62. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  63. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  64. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  65. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  66. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  67. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  68. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  69. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  70. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  71. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  72. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  73. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  74. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  75. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  76. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  77. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  78. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  79. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  80. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  81. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  82. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  83. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  84. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  85. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  86. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  87. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  88. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  89. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  90. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  91. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  92. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  93. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  94. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  95. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  96. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  97. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  98. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  99. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  100. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  101. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  102. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  103. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  104. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  105. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }



  106. <pre> <?php /** * @author Andrii Kasian */ $captcha = new Captcha4d ( ) ; $captcha -> render ( ) ; class Captcha4d { const CHARS = 'WEafRTYIPAGHJKXBNM3479j' ; protected $hypot = 5 ; protected $image = null ; protected $_sin = array ( ) ; protected $text = '' ; public function __construct ( ) { $this -> time = microtime ( true ) ; $this -> generateCode ( ) ; } protected function generateCode ( ) { $chars = self :: CHARS ; for ( $i = 0 ; $i < 3 ; $i ++ ) { $this -> text .= $chars { mt_rand ( 0 , 22 ) } ; } } public function getText ( ) { return $this -> text ; } protected function getProection ( $x , $y , $z ) { $xx = 0.70710 ; $xz = 0 ; $xy = 0.70710 ; $yx = 0.40824 ; $yz = 0.81649 ; $yy = - 0.40824 ; $cx = $xx * $x + $xy * $y + $xz * $z - 5 ; $cy = $yx * $x + $yy * $y + $yz * $z + 20 ; return array ( 'x' => $cx * $this -> hypot , 'y' => $cy * $this -> hypot ) ; } function zFunction ( $x , $y ) { $z = imagecolorat ( $this -> image , $y / 2 , $x / 2 ) > 0 ? 3 : 0 ; if ( $z != 0 ) { $z += - 2 + 2 * $this -> _sin [ ( $x + $this -> startX ) % 30 ] * $this -> _sin [ ( $y + $this -> startY ) % 30 ] ; } $z += mt_rand ( 0 , 30 ) / 50 ; return $z ; } public function render ( ) { $xx = 30 ; $yy = 60 ; $animation = new Imagick ( ) ; $animation -> setFormat ( "gif" ) ; $cw = new ImagickPixel ( "white" ) ; $cb = new ImagickPixel ( "#000000" ) ; $this -> image = imageCreateTrueColor ( 100 , 20 ) ; $whiteColor = imageColorAllocate ( $this -> image , 255 , 255 , 255 ) ; imageFilledRectangle ( $this -> image , 0 , 0 , $yy * $this -> hypot , $xx * $this -> hypot , $whiteColor ) ; $textColor = imageColorAllocate ( $this -> image , 0 , 0 , 0 ) ; imageString ( $this -> image , 5 , 3 , 0 , $this -> text , $textColor ) ; $cof = 2 * 3.141592654 / $xx ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { $this -> _sin [ $x ] = sin ( $x * $cof ) ; } $this -> startX = mt_rand ( 0 , $xx ) ; $this -> startY = mt_rand ( 0 , $yy ) ; $draw = new ImagickDraw ( ) ; $countFrame = 25 ; for ( $i = 0 ; $i < $countFrame ; $i ++ ) { $this -> startX += $xx / $countFrame ; $coordinates = array ( ) ; for ( $x = 0 ; $x < $xx + 1 ; $x ++ ) { for ( $y = 0 ; $y < $yy + 1 ; $y ++ ) { $coordinates [ $x ] [ $y ] = $this -> getProection ( $x , $y , $this -> zFunction ( $x , $y ) ) ; } } $animation -> newImage ( $yy * $this -> hypot , $xx * $this -> hypot , $cw ) ; $im = new ImagickDraw ( ) ; $im -> setFillColor ( $cw ) ; $im -> setStrokeColor ( $cb ) ; $im -> setStrokeAntialias ( true ) ; for ( $x = 0 ; $x < $xx ; $x ++ ) { for ( $y = 0 ; $y < $yy ; $y ++ ) { $coord = array ( ) ; $coord [ ] = $coordinates [ $x ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y ] ; $coord [ ] = $coordinates [ $x + 1 ] [ $y + 1 ] ; $coord [ ] = $coordinates [ $x ] [ $y + 1 ] ; $im -> polygon ( $coord ) ; } } $animation -> drawImage ( $im ) ; $animation -> setImageDelay ( 100 / $countFrame ) ; } header ( "Content-Type: image/gif" ) ; echo $animation -> getImagesBlob ( ) ; die ( ) ; } }







素敵な月曜日、Habraの仲間がいます!



PS。 このキャプチャは、キャプチャとして使用することを意図していません(ユーザーの脳を破壊し、トラフィックでチャネルを詰まらせます)



All Articles