public function __construct($cSym)
 {
     switch (strlen($cSym)) {
         case 3:
             $this->base = $cSym;
             $this->key = base2view($cSym);
             $this->bsw = key2bsw($this->key);
             break;
         case 5:
             $this->base = substr($cSym, 0, 3);
             $this->key = $cSym;
             $this->bsw = key2bsw($this->key);
             break;
         case 9:
             $this->base = substr($cSym, 0, 3);
             $this->key = bsw2key($cSym);
             $this->bsw = $cSym;
             break;
     }
     $this->png = key2png($this->key);
     $img = imagecreatefromstring($this->png);
     $this->width = ImageSX($img);
     $this->height = ImageSY($img);
     $this->centerX = ImageSX($img) / 2;
     $this->centerY = ImageSY($img) / 2;
     imagedestroy($img);
 }
        $extra .= '&size=' . $size;
    }
    if ($colorize) {
        $extra .= '&colorize=1';
    } else {
        $extra .= '&line=' . $line;
    }
    $extra .= '&fill=' . $fill;
    $extra .= '&back=' . $back;
    if ($view) {
        $chars = str_split(bsw2iswa($bsw), 9);
        $chars = array_unique($chars);
        sort($chars, SORT_STRING);
        $syms = array();
        foreach ($chars as $bsw) {
            $base = substr($bsw, 0, 3);
            $syms[$base][] = $bsw;
        }
        foreach ($syms as $base => $chars) {
            $bs_id = $iswa->key2id(bsw2key($base), 4);
            echo '<h1>' . $msg['iswa_' . $bs_id] . ' <img src="glyph.php?key=' . base2view($base) . $extra . '">' . '</h1>';
            foreach ($chars as $bsw) {
                echo '<img src="glyph.php?bsw=' . $bsw . $extra . '&name=' . bsw2key($bsw) . '"> ';
            }
        }
    }
}
?>
</div></body>
</html>
    $key = $base . dechex($dfill) . dechex($drot);
} else {
    if ($base) {
        $key = base2view($base);
    } else {
        if ($key) {
            $base = substr($key, 0, 3);
        } else {
            if ($bsw) {
                $base = substr($bsw, 0, 3);
                if (strlen($bsw) > 3) {
                    $hfill = char2fill(substr($bsw, 3, 3));
                    $hrot = char2rot(substr($bsw, 6, 3));
                    $key = $base . $hfill . $hrot;
                } else {
                    $key = base2view($base);
                }
            } else {
                die;
            }
        }
    }
}
$file = 'iswa/' . $base . '/' . $key . '.png';
$im_src = imagecreatefrompng($file);
if ($colorize) {
    $line = '';
}
if (!$colorize and !$line) {
    $line = "000000";
}
    $rs = @mkdir($dir . '/iswa', 0777);
    if (!$rs) {
        die('Fail: could not make directory for this stamp for ' . $stamp);
    }
}
//main extract array of symbols
$extract = array();
//get iswa list of bsw
$chars = str_split(bsw2iswa($bsw), 9);
//get a list of chars
foreach ($chars as $char) {
    $key = bsw2key($char);
    $extract[$key] = 1;
    $key = base2view(substr($char, 0, 3));
    $extract[$key] = 1;
    $key = base2view(base2group(substr($char, 0, 3)));
    $extract[$key] = 1;
}
ksort($extract);
//cycle through the iswa chars and copy
if (!is_dir($dir . '/iswa')) {
    mkdir($dir . '/iswa');
}
foreach ($extract as $key => $val) {
    $base = substr($key, 0, 3);
    $file = 'iswa/' . $base . '/' . $key . '.png';
    //  echo "<img src='" . $file . "'>&nbsp;&nbsp;";
    $idir = $dir . '/iswa/' . $base;
    if (!is_dir($idir)) {
        mkdir($idir);
    }