[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/captcha/ -> captcha_gd_wave.php (source)

   1  <?php
   2  /**
   3  *
   4  * @package VC
   5  * @version $Id$
   6  * @copyright (c) 2006 phpBB Group
   7  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   8  *
   9  */
  10  
  11  /**
  12  * Wave3D CAPTCHA
  13  *
  14  * @author Robert Hetzler
  15  * @package VC
  16  */
  17  class captcha
  18  {
  19      var $width        = 360;
  20      var $height        = 96;
  21  
  22  	function execute($code, $seed)
  23      {
  24          global $starttime;
  25  
  26          // seed the random generator
  27          mt_srand($seed);
  28  
  29          // set height and width
  30          $img_x = $this->width;
  31          $img_y = $this->height;
  32  
  33          // Generate image
  34          $img    = imagecreatetruecolor($img_x, $img_y);
  35          $x_grid = mt_rand(6, 10);
  36          $y_grid = mt_rand(6, 10);
  37  
  38          // Ok, so lets cut to the chase. We could accurately represent this in 3d and
  39          // do all the appropriate linear transforms. my questions is... why bother?
  40          // The computational overhead is unnecessary when you consider the simple fact:
  41          // we're not here to accurately represent a model, but to just show off some random-ish
  42          // polygons
  43  
  44          // Conceive of 3 spaces.
  45          // 1) planar-space (discrete "pixel" grid)
  46          // 2) 3-space. (planar-space with z/height aspect)
  47          // 3) image space (pixels on the screen)
  48          // resolution of the planar-space we're embedding the text code in
  49          $plane_x    = 100;
  50          $plane_y    = 30;
  51  
  52          $subdivision_factor = 3;
  53  
  54          // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space
  55          $box = array(
  56              'upper_left'    => array(
  57                  'x' => mt_rand(5, 15),
  58                  'y' => mt_rand(10, 15)
  59              ),
  60              'upper_right'    => array(
  61                  'x' => mt_rand($img_x - 35, $img_x - 19),
  62                  'y' => mt_rand(10, 17)
  63              ),
  64              'lower_left'    => array(
  65                  'x' => mt_rand($img_x - 45, $img_x - 5),
  66                  'y' => mt_rand($img_y - 15, $img_y - 0),
  67              ),
  68          );
  69  
  70          $box['lower_right'] = array(
  71              'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'],
  72              'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'],
  73          );
  74  
  75          // TODO
  76          $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255));
  77          imagefill($img, 0, 0, $background);
  78          $black = imagecolorallocate($img, 0, 0, 0);
  79  
  80          $random = array();
  81          $fontcolors = array();
  82  
  83          for ($i = 0; $i < 15; ++$i)
  84          {
  85              $random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255));
  86          }
  87  
  88          $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120));
  89  
  90           $colors = array();
  91  
  92          $minr = mt_rand(20, 30);
  93          $ming = mt_rand(20, 30);
  94          $minb = mt_rand(20, 30);
  95  
  96          $maxr = mt_rand(150, 230);
  97          $maxg = mt_rand(150, 230);
  98          $maxb = mt_rand(150, 230);
  99  
 100          for ($i = -30; $i <= 30; ++$i)
 101          {
 102              $coeff1 = ($i + 12) / 45;
 103              $coeff2 = 1 - $coeff1;
 104              $colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb));
 105          }
 106  
 107          // $img_buffer is the last row of 3-space positions (converted to img-space), cached
 108          // (using this means we don't need to recalculate all 4 positions for each new polygon,
 109          // merely the newest point that we're adding, which is then cached.
 110          $img_buffer = array(array(), array());
 111  
 112          // In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space
 113          $dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x);
 114          $dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x);
 115  
 116          // In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space
 117          $dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y);
 118          $dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y);
 119  
 120          // Initial captcha-letter offset in planar-space
 121          $plane_offset_x = mt_rand(3, 8);
 122          $plane_offset_y = mt_rand( 12, 15);
 123  
 124          // character map
 125          $map = $this->captcha_bitmaps();
 126  
 127          // matrix
 128          $plane = array();
 129  
 130          // for each character, we'll silkscreen it into our boolean pixel plane
 131          for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c)
 132          {
 133              $letter = $code[$c];
 134  
 135              for ($x = $map['width'] - 1; $x >= 0; --$x)
 136              {
 137                  for ($y = $map['height'] - 1; $y >= 0; --$y)
 138                  {
 139                      if ($map['data'][$letter][$y][$x])
 140                      {
 141                          $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true;
 142                      }
 143                  }
 144              }
 145              $plane_offset_x += 11;
 146          }
 147  
 148          // calculate our first buffer, we can't actually draw polys with these yet
 149          // img_pos_prev == screen x,y location to our immediate left.
 150          // img_pos_cur == current screen x,y location
 151          // we calculate screen position of our
 152          // current cell based on the difference from the previous cell
 153          // rather than recalculating from absolute coordinates
 154          // What we cache into the $img_buffer contains the raised text coordinates.
 155          $img_pos_prev    = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']);
 156          $cur_height        = $prev_height = $this->wave_height(0, 0, $subdivision_factor);
 157          $full_x            = $plane_x * $subdivision_factor;
 158          $full_y            = $plane_y * $subdivision_factor;
 159  
 160          for ($x = 1; $x <= $full_x; ++$x)
 161          {
 162              $cur_height        = $this->wave_height($x, 0, $subdivision_factor);
 163              $offset            = $cur_height - $prev_height;
 164              $img_pos_cur    = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset);
 165  
 166              $img_buffer[0][$x]    = $img_pos_cur;
 167              $img_pos_prev        = $img_pos_cur;
 168              $prev_height        = $cur_height;
 169          }
 170  
 171          for ($y = 1; $y <= $full_y; ++$y)
 172          {
 173              // swap buffers
 174              $buffer_cur        = $y & 1;
 175              $buffer_prev    = 1 - $buffer_cur;
 176  
 177              $prev_height    = $this->wave_height(0, $y, $subdivision_factor);
 178              $offset            = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor);
 179              $img_pos_cur    = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1));
 180  
 181              // make sure we don't try to write off the page
 182              $img_pos_prev    = $img_pos_cur;
 183  
 184              $img_buffer[$buffer_cur][0]    = $img_pos_cur;
 185  
 186              for ($x = 1; $x <= $full_x; ++$x)
 187              {
 188                  $cur_height        = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid);
 189  
 190                  // height is a z-factor, not a y-factor
 191                  $offset            = $cur_height - $prev_height;
 192                  $img_pos_cur    = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset);
 193  
 194                  // height is float, index it to an int, get closest color
 195                  $color            = $colors[intval($cur_height)];
 196                  $img_pos_prev    = $img_pos_cur;
 197                  $prev_height    = $cur_height;
 198  
 199                  $y_index_old = intval(($y - 1) / $subdivision_factor);
 200                  $y_index_new = intval($y / $subdivision_factor);
 201                  $x_index_old = intval(($x - 1) / $subdivision_factor);
 202                  $x_index_new = intval($x / $subdivision_factor);
 203  
 204                  if (!empty($plane[$y_index_new][$x_index_new]))
 205                  {
 206                      $img_pos_cur[1]    += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height;
 207                      $color            = $colors[20];
 208                  }
 209                  $img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1);
 210                  $img_buffer[$buffer_cur][$x] = $img_pos_cur;
 211  
 212                  // Smooth the edges as much as possible by having not more than one low<->high traingle per square
 213                  // Otherwise, just
 214                  $diag_down    = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new]));
 215                  $diag_up    = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old]));
 216  
 217                  // natural switching
 218                  $mode = ($x + $y) & 1;
 219  
 220                  // override if it requires it
 221                  if ($diag_down != $diag_up)
 222                  {
 223                      $mode = $diag_up;
 224                  }
 225  
 226                  if ($mode)
 227                  {
 228                      //        +-/              /
 229                      // 1    |/        2     /|
 230                      //        /            /-+
 231                      $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]);
 232                      $poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]);
 233                  }
 234                  else
 235                  {
 236                      //        \            \-+
 237                      // 1    |\        2     \|
 238                      //        +-\              \
 239                      $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]);
 240                      $poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]);
 241                  }
 242  
 243                  imagefilledpolygon($img, $poly1, 3, $color);
 244                  imagefilledpolygon($img, $poly2, 3, $color);
 245              }
 246          }
 247  
 248          // Output image
 249          header('Content-Type: image/png');
 250          header('Cache-control: no-cache, no-store');
 251          //$mtime = explode(' ', microtime());
 252          //$totaltime = $mtime[0] + $mtime[1] - $starttime;
 253  
 254          //echo $totaltime . "<br />\n";
 255          //echo memory_get_usage() - $tmp;
 256          imagepng($img);
 257          imagedestroy($img);
 258      }
 259  
 260  	function wave_height($x, $y, $factor = 1, $tweak = 0.7)
 261      {
 262          // stretch the wave. TODO: pretty it up
 263          $x = $x/5 + 180;
 264          $y = $y/4;
 265          return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak);
 266      }
 267  
 268  	function grid_height($x, $y, $factor = 1, $x_grid, $y_grid)
 269      {
 270          return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0);
 271      }
 272  
 273  	function captcha_bitmaps()
 274      {
 275          return array(
 276              'width'        => 9,
 277              'height'    => 13,
 278              'data'        => array(
 279                  'A' => array(
 280                      array(0,0,1,1,1,1,0,0,0),
 281                      array(0,1,0,0,0,0,1,0,0),
 282                      array(1,0,0,0,0,0,0,1,0),
 283                      array(1,0,0,0,0,0,0,1,0),
 284                      array(1,0,0,0,0,0,0,1,0),
 285                      array(1,0,0,0,0,0,0,1,0),
 286                      array(1,0,0,0,0,0,0,1,0),
 287                      array(1,1,1,1,1,1,1,1,0),
 288                      array(1,0,0,0,0,0,0,1,0),
 289                      array(1,0,0,0,0,0,0,1,0),
 290                      array(1,0,0,0,0,0,0,1,0),
 291                      array(1,0,0,0,0,0,0,1,0),
 292                      array(1,0,0,0,0,0,0,1,0),
 293                      array(0,0,0,0,0,0,0,0,0),
 294                  ),
 295                  'B' => array(
 296                      array(1,1,1,1,1,1,0,0,0),
 297                      array(1,0,0,0,0,0,1,0,0),
 298                      array(1,0,0,0,0,0,0,1,0),
 299                      array(1,0,0,0,0,0,0,1,0),
 300                      array(1,0,0,0,0,0,0,1,0),
 301                      array(1,0,0,0,0,0,1,0,0),
 302                      array(1,1,1,1,1,1,0,0,0),
 303                      array(1,0,0,0,0,0,1,0,0),
 304                      array(1,0,0,0,0,0,0,1,0),
 305                      array(1,0,0,0,0,0,0,1,0),
 306                      array(1,0,0,0,0,0,0,1,0),
 307                      array(1,0,0,0,0,0,1,0,0),
 308                      array(1,1,1,1,1,1,0,0,0),
 309                      array(0,0,0,0,0,0,0,0,0),
 310                  ),
 311                  'C' => array(
 312                      array(0,0,1,1,1,1,1,0,0),
 313                      array(0,1,0,0,0,0,0,1,0),
 314                      array(1,0,0,0,0,0,0,0,1),
 315                      array(1,0,0,0,0,0,0,0,0),
 316                      array(1,0,0,0,0,0,0,0,0),
 317                      array(1,0,0,0,0,0,0,0,0),
 318                      array(1,0,0,0,0,0,0,0,0),
 319                      array(1,0,0,0,0,0,0,0,0),
 320                      array(1,0,0,0,0,0,0,0,0),
 321                      array(1,0,0,0,0,0,0,0,1),
 322                      array(0,1,0,0,0,0,0,1,0),
 323                      array(0,0,1,1,1,1,1,0,0),
 324                      array(0,0,0,0,0,0,0,0,0),
 325                      array(0,0,0,0,0,0,0,0,0),
 326                  ),
 327                  'D' => array(
 328                      array(1,1,1,1,1,1,1,0,0),
 329                      array(1,0,0,0,0,0,0,1,0),
 330                      array(1,0,0,0,0,0,0,0,1),
 331                      array(1,0,0,0,0,0,0,0,1),
 332                      array(1,0,0,0,0,0,0,0,1),
 333                      array(1,0,0,0,0,0,0,0,1),
 334                      array(1,0,0,0,0,0,0,0,1),
 335                      array(1,0,0,0,0,0,0,0,1),
 336                      array(1,0,0,0,0,0,0,0,1),
 337                      array(1,0,0,0,0,0,0,1,0),
 338                      array(1,1,1,1,1,1,1,0,0),
 339                      array(0,0,0,0,0,0,0,0,0),
 340                      array(0,0,0,0,0,0,0,0,0),
 341                      array(0,0,0,0,0,0,0,0,0),
 342                  ),
 343                  'E' => array(
 344                      array(0,0,1,1,1,1,1,1,1),
 345                      array(0,1,0,0,0,0,0,0,0),
 346                      array(1,0,0,0,0,0,0,0,0),
 347                      array(1,0,0,0,0,0,0,0,0),
 348                      array(1,0,0,0,0,0,0,0,0),
 349                      array(1,1,1,1,1,1,1,0,0),
 350                      array(1,0,0,0,0,0,0,0,0),
 351                      array(1,0,0,0,0,0,0,0,0),
 352                      array(1,0,0,0,0,0,0,0,0),
 353                      array(0,1,0,0,0,0,0,0,0),
 354                      array(0,0,1,1,1,1,1,1,1),
 355                      array(0,0,0,0,0,0,0,0,0),
 356                      array(0,0,0,0,0,0,0,0,0),
 357                      array(0,0,0,0,0,0,0,0,0),
 358                  ),
 359                  'F' => array(
 360                      array(0,0,1,1,1,1,1,1,0),
 361                      array(0,1,0,0,0,0,0,0,0),
 362                      array(1,0,0,0,0,0,0,0,0),
 363                      array(1,0,0,0,0,0,0,0,0),
 364                      array(1,0,0,0,0,0,0,0,0),
 365                      array(1,1,1,1,1,1,0,0,0),
 366                      array(1,0,0,0,0,0,0,0,0),
 367                      array(1,0,0,0,0,0,0,0,0),
 368                      array(1,0,0,0,0,0,0,0,0),
 369                      array(1,0,0,0,0,0,0,0,0),
 370                      array(1,0,0,0,0,0,0,0,0),
 371                      array(1,0,0,0,0,0,0,0,0),
 372                      array(0,0,0,0,0,0,0,0,0),
 373                      array(0,0,0,0,0,0,0,0,0),
 374                  ),
 375                  'G' => array(
 376                      array(0,0,1,1,1,1,1,0,0),
 377                      array(0,1,0,0,0,0,0,1,0),
 378                      array(1,0,0,0,0,0,0,0,1),
 379                      array(1,0,0,0,0,0,0,0,1),
 380                      array(1,0,0,0,0,0,0,0,0),
 381                      array(1,0,0,0,0,0,0,0,0),
 382                      array(1,0,0,0,0,0,0,0,0),
 383                      array(1,0,0,0,0,0,0,1,1),
 384                      array(1,0,0,0,0,0,0,0,1),
 385                      array(1,0,0,0,0,0,0,0,1),
 386                      array(0,1,0,0,0,0,0,1,0),
 387                      array(0,0,1,1,1,1,1,0,0),
 388                      array(0,0,0,0,0,0,0,0,0),
 389                      array(0,0,0,0,0,0,0,0,0),
 390                  ),
 391                  'H' => array(
 392                      array(1,0,0,0,0,0,1,0,0),
 393                      array(1,0,0,0,0,0,1,0,0),
 394                      array(1,0,0,0,0,0,1,0,0),
 395                      array(1,0,0,0,0,0,1,0,0),
 396                      array(1,0,0,0,0,0,1,0,0),
 397                      array(1,1,1,1,1,1,1,0,0),
 398                      array(1,0,0,0,0,0,1,0,0),
 399                      array(1,0,0,0,0,0,1,0,0),
 400                      array(1,0,0,0,0,0,1,0,0),
 401                      array(1,0,0,0,0,0,1,0,0),
 402                      array(1,0,0,0,0,0,1,0,0),
 403                      array(0,0,0,0,0,0,0,0,0),
 404                      array(0,0,0,0,0,0,0,0,0),
 405                      array(0,0,0,0,0,0,0,0,0),
 406                  ),
 407                  'I' => array(
 408                      array(0,1,1,1,1,1,1,1,0),
 409                      array(0,0,0,0,1,0,0,0,0),
 410                      array(0,0,0,0,1,0,0,0,0),
 411                      array(0,0,0,0,1,0,0,0,0),
 412                      array(0,0,0,0,1,0,0,0,0),
 413                      array(0,0,0,0,1,0,0,0,0),
 414                      array(0,0,0,0,1,0,0,0,0),
 415                      array(0,0,0,0,1,0,0,0,0),
 416                      array(0,0,0,0,1,0,0,0,0),
 417                      array(0,1,1,1,1,1,1,1,0),
 418                      array(0,0,0,0,0,0,0,0,0),
 419                      array(0,0,0,0,0,0,0,0,0),
 420                      array(0,0,0,0,0,0,0,0,0),
 421                      array(0,0,0,0,0,0,0,0,0),
 422                  ),
 423                  'J' => array(
 424                      array(0,0,0,0,0,0,1,1,1),
 425                      array(0,0,0,0,0,0,0,0,1),
 426                      array(0,0,0,0,0,0,0,0,1),
 427                      array(0,0,0,0,0,0,0,0,1),
 428                      array(0,0,0,0,0,0,0,0,1),
 429                      array(0,0,0,0,0,0,0,0,1),
 430                      array(0,0,0,0,0,0,0,0,1),
 431                      array(0,1,0,0,0,0,0,0,1),
 432                      array(0,1,0,0,0,0,0,0,1),
 433                      array(0,0,1,0,0,0,0,1,0),
 434                      array(0,0,0,1,1,1,1,0,0),
 435                      array(0,0,0,0,0,0,0,0,0),
 436                      array(0,0,0,0,0,0,0,0,0),
 437                      array(0,0,0,0,0,0,0,0,0),
 438                  ),
 439                  'K' => array(
 440                      array(1,0,0,0,0,0,1,0,0),
 441                      array(1,0,0,0,0,1,0,0,0),
 442                      array(1,0,0,0,1,0,0,0,0),
 443                      array(1,0,0,1,0,0,0,0,0),
 444                      array(1,0,1,0,0,0,0,0,0),
 445                      array(1,1,0,0,0,0,0,0,0),
 446                      array(1,0,1,0,0,0,0,0,0),
 447                      array(1,0,0,1,0,0,0,0,0),
 448                      array(1,0,0,0,1,0,0,0,0),
 449                      array(1,0,0,0,0,1,0,0,0),
 450                      array(1,0,0,0,0,0,1,0,0),
 451                      array(0,0,0,0,0,0,0,0,0),
 452                      array(0,0,0,0,0,0,0,0,0),
 453                      array(0,0,0,0,0,0,0,0,0),
 454                  ),
 455                  'L' => array(
 456                      array(1,0,0,0,0,0,0,0,0),
 457                      array(1,0,0,0,0,0,0,0,0),
 458                      array(1,0,0,0,0,0,0,0,0),
 459                      array(1,0,0,0,0,0,0,0,0),
 460                      array(1,0,0,0,0,0,0,0,0),
 461                      array(1,0,0,0,0,0,0,0,0),
 462                      array(1,0,0,0,0,0,0,0,0),
 463                      array(1,0,0,0,0,0,0,0,0),
 464                      array(1,0,0,0,0,0,0,0,0),
 465                      array(0,1,0,0,0,0,0,0,0),
 466                      array(0,0,1,1,1,1,0,0,0),
 467                      array(0,0,0,0,0,0,0,0,0),
 468                      array(0,0,0,0,0,0,0,0,0),
 469                      array(0,0,0,0,0,0,0,0,0),
 470                  ),
 471                  'M' => array(
 472                      array(0,1,0,0,0,0,0,1,0),
 473                      array(0,1,1,0,0,0,1,1,0),
 474                      array(0,1,0,1,0,1,0,1,0),
 475                      array(0,1,0,0,1,0,0,1,0),
 476                      array(0,1,0,0,0,0,0,1,0),
 477                      array(0,1,0,0,0,0,0,1,0),
 478                      array(0,1,0,0,0,0,0,1,0),
 479                      array(0,1,0,0,0,0,0,1,0),
 480                      array(0,1,0,0,0,0,0,1,0),
 481                      array(0,0,0,0,0,0,0,0,0),
 482                      array(0,0,0,0,0,0,0,0,0),
 483                      array(0,0,0,0,0,0,0,0,0),
 484                      array(0,0,0,0,0,0,0,0,0),
 485                      array(0,0,0,0,0,0,0,0,0),
 486                  ),
 487                  'N' => array(
 488                      array(1,0,0,0,0,0,0,0,1),
 489                      array(1,1,0,0,0,0,0,0,1),
 490                      array(1,0,1,0,0,0,0,0,1),
 491                      array(1,0,0,1,0,0,0,0,1),
 492                      array(1,0,0,0,1,0,0,0,1),
 493                      array(1,0,0,0,0,1,0,0,1),
 494                      array(1,0,0,0,0,0,1,0,1),
 495                      array(1,0,0,0,0,0,0,1,1),
 496                      array(1,0,0,0,0,0,0,0,1),
 497                      array(0,0,0,0,0,0,0,0,0),
 498                      array(0,0,0,0,0,0,0,0,0),
 499                      array(0,0,0,0,0,0,0,0,0),
 500                      array(0,0,0,0,0,0,0,0,0),
 501                      array(0,0,0,0,0,0,0,0,0),
 502                  ),
 503                  'O' => array(
 504                      array(0,0,0,1,1,1,0,0,0),
 505                      array(0,0,1,0,0,0,1,0,0),
 506                      array(0,1,0,0,0,0,0,1,0),
 507                      array(1,0,0,0,0,0,0,0,1),
 508                      array(1,0,0,0,0,0,0,0,1),
 509                      array(1,0,0,0,0,0,0,0,1),
 510                      array(1,0,0,0,0,0,0,0,1),
 511                      array(1,0,0,0,0,0,0,0,1),
 512                      array(0,1,0,0,0,0,0,1,0),
 513                      array(0,0,1,0,0,0,1,0,0),
 514                      array(0,0,0,1,1,1,0,0,0),
 515                      array(0,0,0,0,0,0,0,0,0),
 516                      array(0,0,0,0,0,0,0,0,0),
 517                      array(0,0,0,0,0,0,0,0,0),
 518                  ),
 519                  'P' => array(
 520                      array(1,1,1,1,1,1,0,0,0),
 521                      array(1,0,0,0,0,0,1,0,0),
 522                      array(1,0,0,0,0,0,0,1,0),
 523                      array(1,0,0,0,0,0,0,1,0),
 524                      array(1,0,0,0,0,0,0,1,0),
 525                      array(1,0,0,0,0,0,0,1,0),
 526                      array(1,0,0,0,0,0,1,0,0),
 527                      array(1,1,1,1,1,1,0,0,0),
 528                      array(1,0,0,0,0,0,0,0,0),
 529                      array(1,0,0,0,0,0,0,0,0),
 530                      array(1,0,0,0,0,0,0,0,0),
 531                      array(1,0,0,0,0,0,0,0,0),
 532                      array(1,0,0,0,0,0,0,0,0),
 533                      array(0,0,0,0,0,0,0,0,0),
 534                  ),
 535                  'Q' => array(
 536                      array(0,0,1,1,1,1,0,0,0),
 537                      array(0,1,0,0,0,0,1,0,0),
 538                      array(1,0,0,0,0,0,0,1,0),
 539                      array(1,0,0,0,0,0,0,1,0),
 540                      array(1,0,0,0,0,0,0,1,0),
 541                      array(1,0,0,0,0,0,0,1,0),
 542                      array(1,0,0,0,1,0,0,1,0),
 543                      array(1,0,0,0,0,1,0,1,0),
 544                      array(0,1,0,0,0,0,1,0,0),
 545                      array(0,0,1,1,1,1,0,1,0),
 546                      array(0,0,0,0,0,0,0,0,1),
 547                      array(0,0,0,0,0,0,0,0,0),
 548                      array(0,0,0,0,0,0,0,0,0),
 549                      array(0,0,0,0,0,0,0,0,0),
 550                  ),
 551                  'R' => array(
 552                      array(1,1,1,1,1,1,0,0,0),
 553                      array(1,0,0,0,0,0,1,0,0),
 554                      array(1,0,0,0,0,0,0,1,0),
 555                      array(1,0,0,0,0,0,0,1,0),
 556                      array(1,0,0,0,0,0,0,1,0),
 557                      array(1,0,0,0,0,0,1,0,0),
 558                      array(1,1,1,1,1,1,0,0,0),
 559                      array(1,0,1,0,0,0,0,0,0),
 560                      array(1,0,0,1,0,0,0,0,0),
 561                      array(1,0,0,0,1,0,0,0,0),
 562                      array(1,0,0,0,0,1,0,0,0),
 563                      array(1,0,0,0,0,0,1,0,0),
 564                      array(0,0,0,0,0,0,0,0,0),
 565                      array(0,0,0,0,0,0,0,0,0),
 566                  ),
 567                  'S' => array(
 568                      array(0,0,1,1,1,1,1,1,1),
 569                      array(0,1,0,0,0,0,0,0,0),
 570                      array(1,0,0,0,0,0,0,0,0),
 571                      array(1,0,0,0,0,0,0,0,0),
 572                      array(1,0,0,0,0,0,0,0,0),
 573                      array(0,1,0,0,0,0,0,0,0),
 574                      array(0,0,1,1,1,1,1,0,0),
 575                      array(0,0,0,0,0,0,0,1,0),
 576                      array(0,0,0,0,0,0,0,0,1),
 577                      array(0,0,0,0,0,0,0,0,1),
 578                      array(0,0,0,0,0,0,0,1,0),
 579                      array(1,1,1,1,1,1,1,0,0),
 580                      array(0,0,0,0,0,0,0,0,0),
 581                      array(0,0,0,0,0,0,0,0,0),
 582                  ),
 583                  'T' => array(
 584                      array(1,1,1,1,1,1,1,1,1),
 585                      array(0,0,0,0,1,0,0,0,0),
 586                      array(0,0,0,0,1,0,0,0,0),
 587                      array(0,0,0,0,1,0,0,0,0),
 588                      array(0,0,0,0,1,0,0,0,0),
 589                      array(0,0,0,0,1,0,0,0,0),
 590                      array(0,0,0,0,1,0,0,0,0),
 591                      array(0,0,0,0,1,0,0,0,0),
 592                      array(0,0,0,0,1,0,0,0,0),
 593                      array(0,0,0,0,1,0,0,0,0),
 594                      array(0,0,0,0,1,0,0,0,0),
 595                      array(0,0,0,0,0,0,0,0,0),
 596                      array(0,0,0,0,0,0,0,0,0),
 597                      array(0,0,0,0,0,0,0,0,0),
 598                  ),
 599                  'U' => array(
 600                      array(1,0,0,0,0,0,0,0,1),
 601                      array(1,0,0,0,0,0,0,0,1),
 602                      array(1,0,0,0,0,0,0,0,1),
 603                      array(1,0,0,0,0,0,0,0,1),
 604                      array(1,0,0,0,0,0,0,0,1),
 605                      array(1,0,0,0,0,0,0,0,1),
 606                      array(1,0,0,0,0,0,0,0,1),
 607                      array(1,0,0,0,0,0,0,0,1),
 608                      array(1,0,0,0,0,0,0,0,1),
 609                      array(0,1,0,0,0,0,0,1,0),
 610                      array(0,0,1,1,1,1,1,0,0),
 611                      array(0,0,0,0,0,0,0,0,0),
 612                      array(0,0,0,0,0,0,0,0,0),
 613                      array(0,0,0,0,0,0,0,0,0),
 614                  ),
 615                  'V' => array(
 616                      array(1,0,0,0,0,0,0,0,1),
 617                      array(1,0,0,0,0,0,0,0,1),
 618                      array(1,0,0,0,0,0,0,0,1),
 619                      array(1,0,0,0,0,0,0,0,1),
 620                      array(1,0,0,0,0,0,0,0,1),
 621                      array(1,0,0,0,0,0,0,0,1),
 622                      array(1,0,0,0,0,0,0,0,1),
 623                      array(0,1,0,0,0,0,0,1,0),
 624                      array(0,0,1,0,0,0,1,0,0),
 625                      array(0,0,0,1,0,1,0,0,0),
 626                      array(0,0,0,0,1,0,0,0,0),
 627                      array(0,0,0,0,0,0,0,0,0),
 628                      array(0,0,0,0,0,0,0,0,0),
 629                      array(0,0,0,0,0,0,0,0,0),
 630                  ),
 631                  'W' => array(
 632                      array(1,0,0,0,0,0,0,0,1),
 633                      array(1,0,0,0,0,0,0,0,1),
 634                      array(1,0,0,0,0,0,0,0,1),
 635                      array(1,0,0,0,0,0,0,0,1),
 636                      array(1,0,0,0,1,0,0,0,1),
 637                      array(1,0,0,1,0,1,0,0,1),
 638                      array(1,0,1,0,0,0,1,0,1),
 639                      array(1,1,0,0,0,0,0,1,1),
 640                      array(1,0,0,0,0,0,0,0,1),
 641                      array(0,0,0,0,0,0,0,0,0),
 642                      array(0,0,0,0,0,0,0,0,0),
 643                      array(0,0,0,0,0,0,0,0,0),
 644                      array(0,0,0,0,0,0,0,0,0),
 645                      array(0,0,0,0,0,0,0,0,0),
 646                  ),
 647                  'X' => array(
 648                      array(1,0,0,0,0,0,0,0,1),
 649                      array(1,0,0,0,0,0,0,0,1),
 650                      array(0,1,0,0,0,0,0,1,0),
 651                      array(0,0,1,0,0,0,1,0,0),
 652                      array(0,0,0,1,0,1,0,0,0),
 653                      array(0,0,0,0,1,0,0,0,0),
 654                      array(0,0,0,1,0,1,0,0,0),
 655                      array(0,0,1,0,0,0,1,0,0),
 656                      array(0,1,0,0,0,0,0,1,0),
 657                      array(1,0,0,0,0,0,0,0,1),
 658                      array(1,0,0,0,0,0,0,0,1),
 659                      array(0,0,0,0,0,0,0,0,0),
 660                      array(0,0,0,0,0,0,0,0,0),
 661                      array(0,0,0,0,0,0,0,0,0),
 662                  ),
 663                  'Y' => array(
 664                      array(1,0,0,0,0,0,0,0,1),
 665                      array(1,0,0,0,0,0,0,0,1),
 666                      array(1,0,0,0,0,0,0,0,1),
 667                      array(0,1,0,0,0,0,0,1,0),
 668                      array(0,0,1,0,0,0,1,0,0),
 669                      array(0,0,0,1,0,1,0,0,0),
 670                      array(0,0,0,0,1,0,0,0,0),
 671                      array(0,0,0,0,1,0,0,0,0),
 672                      array(0,0,0,0,1,0,0,0,0),
 673                      array(0,0,0,0,1,0,0,0,0),
 674                      array(0,0,0,0,1,0,0,0,0),
 675                      array(0,0,0,0,0,0,0,0,0),
 676                      array(0,0,0,0,0,0,0,0,0),
 677                      array(0,0,0,0,0,0,0,0,0),
 678                  ),
 679                  'Z' => array(
 680                      array(1,1,1,1,1,1,1,1,1),
 681                      array(1,0,0,0,0,0,0,0,1),
 682                      array(0,0,0,0,0,0,0,1,0),
 683                      array(0,0,0,0,0,0,1,0,0),
 684                      array(0,0,0,0,0,1,0,0,0),
 685                      array(0,0,0,0,1,0,0,0,0),
 686                      array(0,0,0,1,0,0,0,0,0),
 687                      array(0,0,1,0,0,0,0,0,0),
 688                      array(0,1,0,0,0,0,0,0,0),
 689                      array(1,0,0,0,0,0,0,0,1),
 690                      array(1,1,1,1,1,1,1,1,1),
 691                      array(0,0,0,0,0,0,0,0,0),
 692                      array(0,0,0,0,0,0,0,0,0),
 693                      array(0,0,0,0,0,0,0,0,0),
 694                  ),
 695                  '1' => array(
 696                      array(0,0,0,0,1,0,0,0,0),
 697                      array(0,0,0,1,1,0,0,0,0),
 698                      array(0,0,1,0,1,0,0,0,0),
 699                      array(0,1,0,0,1,0,0,0,0),
 700                      array(0,0,0,0,1,0,0,0,0),
 701                      array(0,0,0,0,1,0,0,0,0),
 702                      array(0,0,0,0,1,0,0,0,0),
 703                      array(0,0,0,0,1,0,0,0,0),
 704                      array(0,0,0,0,1,0,0,0,0),
 705                      array(0,0,0,0,1,0,0,0,0),
 706                      array(0,0,0,0,1,0,0,0,0),
 707                      array(0,1,1,1,1,1,1,1,0),
 708                      array(0,0,0,0,0,0,0,0,0),
 709                      array(0,0,0,0,0,0,0,0,0),
 710                  ),
 711                  '2' => array(
 712                      array(0,0,0,1,1,1,0,0,0),
 713                      array(0,0,1,0,0,0,1,0,0),
 714                      array(0,1,0,0,0,0,0,1,0),
 715                      array(0,0,0,0,0,0,0,0,1),
 716                      array(0,0,0,0,0,0,0,0,1),
 717                      array(0,0,0,0,0,0,0,0,1),
 718                      array(0,0,0,0,0,0,0,1,0),
 719                      array(0,0,0,0,0,0,1,0,0),
 720                      array(0,0,0,0,0,1,0,0,0),
 721                      array(0,0,0,0,1,0,0,0,0),
 722                      array(0,0,0,1,0,0,0,0,0),
 723                      array(0,0,1,0,0,0,0,0,0),
 724                      array(0,1,1,1,1,1,1,1,1),
 725                      array(0,0,0,0,0,0,0,0,0),
 726                  ),
 727                  '3' => array(
 728                      array(0,0,0,1,1,1,1,0,0),
 729                      array(0,0,1,0,0,0,0,1,0),
 730                      array(0,1,0,0,0,0,0,0,1),
 731                      array(0,0,0,0,0,0,0,0,1),
 732                      array(0,0,0,0,0,0,0,0,1),
 733                      array(0,0,0,0,0,0,0,1,0),
 734                      array(0,0,0,0,0,1,1,0,0),
 735                      array(0,0,0,0,0,0,0,1,0),
 736                      array(0,0,0,0,0,0,0,0,1),
 737                      array(0,0,0,0,0,0,0,0,1),
 738                      array(0,1,0,0,0,0,0,0,1),
 739                      array(0,0,1,0,0,0,0,1,0),
 740                      array(0,0,0,1,1,1,1,0,0),
 741                      array(0,0,0,0,0,0,0,0,0),
 742                  ),
 743                  '4' => array(
 744                      array(0,0,0,0,0,0,0,1,0),
 745                      array(0,0,0,0,0,0,1,1,0),
 746                      array(0,0,0,0,0,1,0,1,0),
 747                      array(0,0,0,0,1,0,0,1,0),
 748                      array(0,0,0,1,0,0,0,1,0),
 749                      array(0,0,1,0,0,0,0,1,0),
 750                      array(0,1,1,1,1,1,1,1,1),
 751                      array(0,0,0,0,0,0,0,1,0),
 752                      array(0,0,0,0,0,0,0,1,0),
 753                      array(0,0,0,0,0,0,0,1,0),
 754                      array(0,0,0,0,0,0,0,1,0),
 755                      array(0,0,0,0,0,0,0,0,0),
 756                      array(0,0,0,0,0,0,0,0,0),
 757                      array(0,0,0,0,0,0,0,0,0),
 758                  ),
 759                  '5' => array(
 760                      array(1,1,1,1,1,1,1,1,1),
 761                      array(1,0,0,0,0,0,0,0,0),
 762                      array(1,0,0,0,0,0,0,0,0),
 763                      array(1,0,0,0,0,0,0,0,0),
 764                      array(0,1,0,0,0,0,0,0,0),
 765                      array(0,0,1,1,1,1,1,0,0),
 766                      array(0,0,0,0,0,0,0,1,0),
 767                      array(0,0,0,0,0,0,0,0,1),
 768                      array(1,0,0,0,0,0,0,0,1),
 769                      array(0,1,0,0,0,0,0,1,0),
 770                      array(0,0,1,1,1,1,1,0,0),
 771                      array(0,0,0,0,0,0,0,0,0),
 772                      array(0,0,0,0,0,0,0,0,0),
 773                      array(0,0,0,0,0,0,0,0,0),
 774                  ),
 775                  '6' => array(
 776                      array(0,0,1,1,1,1,1,0,0),
 777                      array(0,1,0,0,0,0,0,1,0),
 778                      array(1,0,0,0,0,0,0,0,1),
 779                      array(1,0,0,0,0,0,0,0,0),
 780                      array(1,0,0,0,0,0,0,0,0),
 781                      array(1,0,0,1,1,1,1,0,0),
 782                      array(1,0,1,0,0,0,0,1,0),
 783                      array(1,1,0,0,0,0,0,0,1),
 784                      array(1,0,0,0,0,0,0,0,1),
 785                      array(1,0,0,0,0,0,0,0,1),
 786                      array(0,1,0,0,0,0,0,1,0),
 787                      array(0,0,1,1,1,1,1,0,0),
 788                      array(0,0,0,0,0,0,0,0,0),
 789                      array(0,0,0,0,0,0,0,0,0),
 790                      array(0,0,0,0,0,0,0,0,0),
 791                  ),
 792                  '7' => array(
 793                      array(1,1,1,1,1,1,1,1,1),
 794                      array(1,0,0,0,0,0,0,0,1),
 795                      array(0,0,0,0,0,0,0,1,0),
 796                      array(0,0,0,0,0,0,1,0,0),
 797                      array(0,0,0,0,0,1,0,0,0),
 798                      array(0,0,0,0,1,0,0,0,0),
 799                      array(0,0,0,0,1,0,0,0,0),
 800                      array(0,0,0,0,1,0,0,0,0),
 801                      array(0,0,0,0,1,0,0,0,0),
 802                      array(0,0,0,0,1,0,0,0,0),
 803                      array(0,0,0,0,1,0,0,0,0),
 804                      array(0,0,0,0,0,0,0,0,0),
 805                      array(0,0,0,0,0,0,0,0,0),
 806                      array(0,0,0,0,0,0,0,0,0),
 807                  ),
 808                  '8' => array(
 809                      array(0,0,1,1,1,1,1,0,0),
 810                      array(0,1,0,0,0,0,0,1,0),
 811                      array(1,0,0,0,0,0,0,0,1),
 812                      array(1,0,0,0,0,0,0,0,1),
 813                      array(1,0,0,0,0,0,0,0,1),
 814                      array(0,1,0,0,0,0,0,1,0),
 815                      array(0,0,1,1,1,1,1,0,0),
 816                      array(0,1,0,0,0,0,0,1,0),
 817                      array(1,0,0,0,0,0,0,0,1),
 818                      array(1,0,0,0,0,0,0,0,1),
 819                      array(1,0,0,0,0,0,0,0,1),
 820                      array(0,1,0,0,0,0,0,1,0),
 821                      array(0,0,1,1,1,1,1,0,0),
 822                      array(0,0,0,0,0,0,0,0,0),
 823                  ),
 824                  '9' => array(
 825                      array(0,0,0,1,1,1,1,0,0),
 826                      array(0,0,1,0,0,0,0,1,0),
 827                      array(0,1,0,0,0,0,0,0,1),
 828                      array(0,1,0,0,0,0,0,0,1),
 829                      array(0,1,0,0,0,0,0,0,1),
 830                      array(0,1,0,0,0,0,0,1,1),
 831                      array(0,0,1,1,1,1,1,0,1),
 832                      array(0,0,0,0,0,0,0,0,1),
 833                      array(0,0,0,0,0,0,0,0,1),
 834                      array(0,1,0,0,0,0,0,0,1),
 835                      array(0,0,1,0,0,0,0,1,0),
 836                      array(0,0,0,1,1,1,1,0,0),
 837                      array(0,0,0,0,0,0,0,0,0),
 838                      array(0,0,0,0,0,0,0,0,0),
 839                  ),
 840              )
 841          );
 842      }
 843  }
 844  
 845  ?>


Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1