PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- $symbol=0;
- $reading_symbol=false;
- $alphabet = "0123456789";
- for($i=0;$i<$fontfile_width && $symbol<$alphabet_length;$i++){
- if(!$reading_symbol && !$transparent){
- $reading_symbol=true;
- continue;
- }
- if($reading_symbol && $transparent){
- $font_metrics[$alphabet{$symbol}]['end']=$i;
- $reading_symbol=false;
- $symbol++;
- continue;
- }
- }
- $string = '';
- $x = 5;
- $y = 5;
- for ($i=0;$i<6;$i++) {
- $string .= $char;
- if ($x > 15) $x = $x - 2;
- imagecopy($image,$font,$x,$y,$font_metrics[$char]['start'],1,$font_metrics[$char]['end']-$font_metrics[$char]['start'],42);
- $x += $font_metrics[$char]['end']-$font_metrics[$char]['start'];
- }
- for ($i=0;$i<10;$i++) {
- }
- for ($i=0;$i<2;$i++) {
- }
- $center=$x/2;
- for($x=0;$x<ImageSX($image);$x++){
- for($y=0;$y<ImageSY($image);$y++){
- if($sx<0 || $sy<0 || $sx>=$width-1 || $sy>=$height-1){
- $color=255;
- $color_x=255;
- $color_y=255;
- $color_xy=255;
- }else{
- }
- if($color==0 && $color_x==0 && $color_y==0 && $color_xy==0){
- $newred=$foreground_color[0];
- $newgreen=$foreground_color[1];
- $newblue=$foreground_color[2];
- }else if($color==255 && $color_x==255 && $color_y==255 && $color_xy==255){
- $newred=$background_color[0];
- $newgreen=$background_color[1];
- $newblue=$background_color[2];
- }else{
- $frsx1=1-$frsx;
- $frsy1=1-$frsy;
- $newcolor=(
- $color*$frsx1*$frsy1+
- $color_x*$frsx*$frsy1+
- $color_y*$frsx1*$frsy+
- $color_xy*$frsx*$frsy);
- if($newcolor>255) $newcolor=255;
- $newcolor=$newcolor/255;
- $newcolor0=1-$newcolor;
- $newred=$newcolor0*$foreground_color[0]+$newcolor*$background_color[0];
- $newgreen=$newcolor0*$foreground_color[1]+$newcolor*$background_color[1];
- $newblue=$newcolor0*$foreground_color[2]+$newcolor*$background_color[2];
- }
- }
- }
- $_SESSION['sec_code_session'] = $string;
- $wm_pos_x = ((160) - ($wm_width));
- function ImageSmoothAlphaLine ($image, $x1, $y1, $x2, $y2, $r, $g, $b, $alpha=0) {
- $icr = $r;
- $icg = $g;
- $icb = $b;
- if ($y1 == $y2 || $x1 == $x2)
- else {
- $m = ($y2 - $y1) / ($x2 - $x1);
- $b = $y1 - $m * $x1;
- while ($x < $endx) {
- $y = $m * $x + $b;
- $tcr = ($trgb >> 16) & 0xFF;
- $tcg = ($trgb >> 8) & 0xFF;
- $tcb = $trgb & 0xFF;
- imagesetpixel($image, $x, floor($y), imagecolorallocatealpha($image, ($tcr * $ya + $icr * $yb), ($tcg * $ya + $icg * $yb), ($tcb * $ya + $icb * $yb), $alpha));
- $tcr = ($trgb >> 16) & 0xFF;
- $tcg = ($trgb >> 8) & 0xFF;
- $tcb = $trgb & 0xFF;
- imagesetpixel($image, $x, ceil($y), imagecolorallocatealpha($image, ($tcr * $yb + $icr * $ya), ($tcg * $yb + $icg * $ya), ($tcb * $yb + $icb * $ya), $alpha));
- $x++;
- }
- } else {
- while ($y < $endy) {
- $x = ($y - $b) / $m;
- $tcr = ($trgb >> 16) & 0xFF;
- $tcg = ($trgb >> 8) & 0xFF;
- $tcb = $trgb & 0xFF;
- imagesetpixel($image, floor($x), $y, imagecolorallocatealpha($image, ($tcr * $xa + $icr * $xb), ($tcg * $xa + $icg * $xb), ($tcb * $xa + $icb * $xb), $alpha));
- $tcr = ($trgb >> 16) & 0xFF;
- $tcg = ($trgb >> 8) & 0xFF;
- $tcb = $trgb & 0xFF;
- imagesetpixel ($image, ceil($x), $y, imagecolorallocatealpha($image, ($tcr * $xb + $icr * $xa), ($tcg * $xb + $icg * $xa), ($tcb * $xb + $icb * $xa), $alpha));
- $y ++;
- }
- }
- }
- }