FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[PHP] Problem with Dynamic Sig's Font Color





darvit
Hey everyone, I have a problem with my dynamic signature's font color and I don't know what I'm doing wrong.

I want the color to be (0, 225, 0), but based on this signature, it's practically illegible:


Here's the code for my butler.png file:
Quote:
Code:

<?php
$image_info = array(
    'image'    => 'butler.gif'
);

$image_text_ary = array();
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Domovoi Butler counted to infinity"
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " -- twice."
)
    );
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " When the Troll goes to sleep at night,"
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " he checks his closet for Butler."
    )
);
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Butler doesn't dodge bullets."
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Bullets aren't that stupid."
    )
);
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Butler has already been to Mars;"
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " that's why there's no life there."
    )
);
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Butler doesn't need bulletproof vests;"
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " bulletproof vests need Butler."
    )
);
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " If you can see Butler, he can see you."
    ),
    array(
        'x'     => 70,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " If you can't see Butler, start praying."
    )
);

$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Butler does not sleep."
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " He waits."
    )
);
$image_text_ary[] = array(
    array(
        'x'     => 80,
        'y'     => 25,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Butler does not get frostbite."
    ),
    array(
        'x'     => 80,
        'y'     => 35,
        'color' => array(0, 225, 0),
        'font'  => 6,
        'text'  => " Butler bites frost."
    )
);
$random = time() % count($image_text_ary);
$image_text = $image_text_ary[$random];

include('./includes/dynamic_gd_image02.php');
?>


Here's the code for the dynamic_gd_image02.php file:
Quote:
Code:

<?php
$gdfonts = array(
    '8x13iso', '9x15iso', 'andale12',  'bmreceipt',
    'courier8', 'proggyclean',
    'proggysquare', 'systemex', 'terminal6', 'trisk'
);

//
//
//
if( !isset($image_info) || !isset($image_text) )
{
    exit;
}

//
//
//
$sz = @getimagesize('./images/'.$image_info['image']);
if( !$sz )
{
    exit;
}
$image_w = $sz[0];
$image_h = $sz[1];

//
//
//
@header('Content-type: image/png');

$im = @imagecreatefromgif('./images/'.$image_info['image']);
$rgb = ( isset($image_info['color']) ? $image_info['color'] : array(255, 255, 255) );
$bgColor = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);

for( $i = 0; $i < count($image_text); $i++ )
{
    if( !is_numeric($image_text[$i]['font']) )
    {
        $font = 1;
    }
    else if( $image_text[$i]['font'] < 0 )
    {
        $font = $image_text[$i]['font'] * -1;
    }
    else
    {
        if( !($font = @imageloadfont('./gd_fonts/'.$gdfonts[$image_text[$i]['font']].'.gdf')) )
        {
            $font = 1;
        }
    }
    $rgb = $image_text[$i]['color'];
    $fgColor = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);
    imagestring($im, $font, $image_text[$i]['x'], $image_text[$i]['y'], $image_text[$i]['text'], $fgColor);
}

imagepng($im);
imagedestroy($im);
?>


If I use plain backgrounds, the font color looks okay:



But if I add a bit of design, it won't work:


I'm a PHP newbie and I'm getting frustrated with all this Mad , so please help me if you can. Sad

Thank you very much. Smile

/EDIT: Anyone? Anyone at all? Our rival website just released something similar [yet theirs is crappy], and I'm getting desperate here. *goes off to the Marketplace to think of something.
mathiaus
solved - http://www.frihost.com/forums/vt-73627.html
-close-
Related topics
White font color
A php problem
PHP Login Problem
unexpected T_VARIABLE, expecting
www.Dynamic-Sig.com - Dynamic Signature Images
dynamic sig
Need help with my dynamic sig.
Calling all PHP Gods! 200 frih$ to fix my dynamic sig!
Dynamic sig (know the click)
PHP login script problem
Strange Problem in PHP-MYSQL
Php , Making Dynamic sig
Could there be a PhP problem on the server?
dynamic sig help
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.