function addText($text, $font, $size, $color, $x, $y, $angle = 0)
    {
        global $HTTP_SERVER_VARS;

        if (substr($font, 0, 1) == DIRECTORY_SEPARATOR || (substr($font, 1, 1) == ":" && (substr($font, 2, 1) == "\\" || substr($font, 2, 1) == "/")))
        {
            $prepath = '';
        }
        else
        {
            $prepath = substr($HTTP_SERVER_VARS['SCRIPT_FILENAME'], 0, strrpos($HTTP_SERVER_VARS['SCRIPT_FILENAME'], DIRECTORY_SEPARATOR)) . DIRECTORY_SEPARATOR;
        }
        $text = $this->_iso2uni($text);
        if (is_string($x) || is_string($y))
        {
            $textsize = imagettfbbox($size, $angle, $prepath . $font, $text);
            $textwidth = abs($textsize[2]);
            $textheight = abs($textsize[7]);
            list($xalign, $xalign_offset) = explode(" ", $x);
            list($yalign, $yalign_offset) = explode(" ", $y);
        }
        if (is_string($x))
        {
            switch ($xalign)
            {
                case 'left':
                    $x = 0 + $xalign_offset;
                    break;

                case 'right':
                    $x = ($this->_img['main']['width'] - $textwidth) + $xalign_offset;
                    break;

                case 'middle':
                case 'center':
                    $x = (($this->_img['main']['width'] - $textwidth) / 2) + $xalign_offset;
                    break;
            }
        }
        if (is_string($y))
        {
            switch ($yalign)
            {
                case 'top':
                    $y = (0 + $textheight) + $yalign_offset;
                    break;

                case 'bottom':
                    $y = ($this->_img['main']['height']) + $yalign_offset;
                    break;

                case 'middle':
                case 'center':
                    $y = ((($this->_img['main']['height'] - $textheight) / 2) + $textheight) + $yalign_offset;
                    break;
            }
        }
        imagettftext($this->_img['main']['resource'], $size, $angle, $x, $y, $this->_hexToPHPColor($color), $prepath . $font, $text);
        return true;
    }