} function generate_image($code, $im) { global $characters; global $symbol_width; global $height; for ($i = 0, $x = 0; $i < strlen($code); $i++, $x += $symbol_width) { $char_im = get_char_by_index_from_font($characters[$code[$i]]); imagecopymerge($im, $char_im, $x, 0, 0, 0, $symbol_width, $height, 100); } return $im; } global $symbol_width; global $height; global $characters; $symbol_width = 20; $width = strlen($generation_str) * $symbol_width + 20; $height = 20; $code = $generation_str; $bg_color = array('red' => 255, 'green' => 255, 'blue' => 255, 0 => 255, 1 => 255, 2 => 255); $text_color = array('red' => 0, 'green' => 0, 'blue' => 0, 0 => 0, 1 => 0, 2 => 0); $characters = array('1' => 0, '2' => 1, '3' => 2, '4' => 3, '5' => 4, '6' => 5, '7' => 6, '8' => 7, '9' => 8, '0' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, 'Z' => 35); $im = imagecreatetruecolor($width, $height); $bgcolor = imagecolorallocate($im, $bg_color['red'], $bg_color['green'], $bg_color['blue']); imagefilledrectangle($im, 0, 0, imagesx($im), imagesy($im), $bgcolor); $im = generate_image($code, $im); $im = wave($text_color, $bg_color, $im, $width, $height); $im = draw_lines($im, $width - 10, $height + 20); header("Content-type:image/png"); imagepng($im); imagedestroy($im);
{ print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r("\n"); print_r(" * *\n"); print_r(" * *\n"); print_r(" * *\n"); print_r(" *\n"); print_r(" * * *\n"); print_r(" * * *\n"); print_r(" * * *\n"); print_r(" * \n"); print_r(" * *\n"); print_r(" * *\n"); print_r(" * *\n"); print_r(" * *\n"); } for ($i = 0; $i <= 2; $i++) { wave(); sleep(5); wave2(); sleep(5); }