$im = imagecreate(100, 30);// 白色背景和蓝色文本
$bg = imagecolorallocate($im, 255, 235, 235);
$textColor = imagecolorallocate($im, 255, 255, 255);
imagestring($imgBG, $textFont, $xValue, $yValue, $textValue, $textColor);
这样写有问题吗?
怎么能改变字体颜色,我想写白色的字.

解决方案 »

  1.   

    三种基色,各自做为一个参数imagecolorallocate($im,R,G,B);
    =======================================================
    $textColor = imagecolorallocate($im, 255, 255, 255);//这个是白色字体$textColor = imagecolorallocate($im, 0, 0, 0);//这个是黑色字体
      

  2.   


    大哥,我就是按你这样做的,结果还是黑色,所以我郁闷了.我以为是缓存的原因,后面加了?random也不行
      

  3.   

    http://hi.baidu.com/bary/album/item/a6d5eefa077057f4b58f316b.html结果地址
      

  4.   

    估计你代码哪里写错了吧.
    ==================================
    header("Content-type: image/png");
    $im = imagecreate(100, 30)
    imagecolorallocate($im, 0, 255, 0);//绿底
    $textColor = imagecolorallocate($im, 0, 0, 0);//黑字
    //$textColor = imagecolorallocate($im, 255, 255, 255);//白字
    imagestring($im, 1, 5, 5,  "A Simple Text String", $textColor);
    imagepng($im);
    imagedestroy($im);