I am having some problems generating images with GD.  I am using GD 1.6.2
and trying to create a .png image.  I know it works.  I have created just a
generic graphic without trying to put variables into it and am hoping
someone can help me on this one.  Here is some code snippet

// here is my gd.php file to create the image

<?

Header ( "Content-Type: image/png" );   

$im  =  ImageCreate ( 10,  200 );   
$red  =  ImageColorAllocate ( $im,  255,  0,  0 );   
$white  =  ImageColorAllocate ( $im ,  255,  255,  255 );   
$blue  =  ImageColorAllocate ( $im ,  0 ,  0 ,  255 );   
$gray  =  ImageColorAllocate ( $im , 0xC0, 0xC0 , 0xC0 );   

ImageFill ( $im , 0 , 0 , $gray );   
ImageFilledRectangle ( $im , 0 ,$bluehg, 3, 200, $blue );   
ImageFilledRectangle ( $im , 6, $redhg, 10, 200, $red );   

// write the image
ImagePNG( $im ); 

// clean up the mess
ImageDestroy($im);
?>

// here is the function that I use to determine the attributes of the image

// create a function to call gd.php
function graphic($blueval, $redval)
{
        $pctrd = round($blueval*100, 1);
        $pctbl = round($redval*100, 1);
        $blueval = ($blueval * 200);
        $redval = ($redval * 200);
        
        echo "<table>
                                        <tr>
                                                <td
align=\"center\">$pctbl%</td>
                                                <td><img
src=\"gd.php?bluehg=$blueval&redhg=$redval\" height=\"100\" /></td>
                                                <td
align=\"center\">$pctrd</td>
                                        </tr>
                                </table>";
}

On the page I get a broken image.  If I view the source I see the image is
being called with params.

Any help would be appreciated.

Thanks.

Chad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to