<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

class guildclass
{

    var $logo;

    function mostrarlogo( )
    {
        $size = 64;
        $pixelSize = $size / 8;
        $hex = $this->logo;
        function color( $mark )
        {
            if ( $mark == 0 )
            {
                $color = "#666666";
            }
            if ( $mark == 1 )
            {
                $color = "#000000";
            }
            if ( $mark == 2 )
            {
                $color = "#8c8a8d";
            }
            if ( $mark == 3 )
            {
                $color = "#ffffff";
            }
            if ( $mark == 4 )
            {
                $color = "#fe0000";
            }
            if ( $mark == 5 )
            {
                $color = "#ff8a00";
            }
            if ( $mark == 6 )
            {
                $color = "#ffff00";
            }
            if ( $mark == 7 )
            {
                $color = "#8cff01";
            }
            if ( $mark == 8 )
            {
                $color = "#00ff00";
            }
            if ( $mark == 9 )
            {
                $color = "#01ff8d";
            }
            if ( $mark == "a" || $mark == "A" )
            {
                $color = "#00ffff";
            }
            if ( $mark == "b" || $mark == "B" )
            {
                $color = "#008aff";
            }
            if ( $mark == "c" || $mark == "C" )
            {
                $color = "#0000fe";
            }
            if ( $mark == "d" || $mark == "D" )
            {
                $color = "#8c00ff";
            }
            if ( $mark == "e" || $mark == "E" )
            {
                $color = "#ff00fe";
            }
            if ( $mark == "f" || $mark == "F" )
            {
                $color = "#ff008c";
            }
            return $color;
        }
        $y = 0;
        for ( ; $y < 8; ++$y )
        {
            $x = 0;
            for ( ; $x < 8; ++$x )
            {
                $offset = $y * 8 + $x;
                $Cuadrilla8x8[$y][$x] = substr( $hex, $offset, 1 );
            }
        }
        $SuperCuadrilla = array( );
        $y = 1;
        for ( ; $y <= 8; ++$y )
        {
            $x = 1;
            for ( ; $x <= 8; ++$x )
            {
                $bit = $Cuadrilla8x8[$y - 1][$x - 1];
                $repiteY = 0;
                for ( ; $repiteY < $pixelSize; ++$repiteY )
                {
                    $repite = 0;
                    for ( ; $repite < $pixelSize; ++$repite )
                    {
                        $translatedY = ( $y - 1 ) * $pixelSize + $repiteY;
                        $translatedX = ( $x - 1 ) * $pixelSize + $repite;
                        $SuperCuadrilla[$translatedY][$translatedX] = $bit;
                    }
                }
            }
        }
        $img = imagecreate( $size, $size );
        $y = 0;
        for ( ; $y < $size; ++$y )
        {
            $x = 0;
            for ( ; $x < $size; ++$x )
            {
                $bit = $SuperCuadrilla[$y][$x];
                $color = substr( color( $bit ), 1 );
                $r = substr( $color, 0, 2 );
                $g = substr( $color, 2, 2 );
                $b = substr( $color, 4, 2 );
                $superPixel = imagecreate( 1, 1 );
                $cl = imagecolorallocatealpha( $superPixel, hexdec( $r ), hexdec( $g ), hexdec( $b ), 0 );
                imagefilledrectangle( $superPixel, 0, 0, 1, 1, $cl );
                imagecopy( $img, $superPixel, $x, $y, 0, 0, 1, 1 );
                imagedestroy( $superPixel );
            }
        }
        header( "Content-type: image/gif" );
        imagerectangle( $img, 0, 0, $size - 1, $size - 1, imagecolorallocate( $img, 0, 0, 0 ) );
        imagegif( $img );
    }

}

?>
