Having a brain fart!

Discussion in 'PHP' started by Sleeping Troll, Sep 23, 2008.

  1. #1
    I have a database which contains my color definitions for GD2 in the format:

    ColorName, Red, Green, Blue

    Example:

    Red, 255, 0, 0

    I am pulling the values from the database and want to assign them via GD2"imagecolorallocate", I just can't seem to get my head around it this morning, so please help if you can... This is the code I have so far.

    SQL="Select * From Colors";
    $ColorValues = mysql_query($SQL);
    while $Values = mysql_fetch_array($ColorValues)
    {
    	$ColorName = $Values["Name"];
    	$Red = $Values["Red"];
    	$Green = $Values["Green"];
    	$Blue = $Values["Blue"];
    }
    PHP:
     
    Sleeping Troll, Sep 23, 2008 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    $color = imagecolorallocate ( $image, $Red, $Green, $Blue);
    Code (markup):
    that's it.

    $image must be an image resources identifier.

    regards
     
    Vooler, Sep 23, 2008 IP