<?php>
    $shuipai= ImageCreateFromJPEG("kuaisu.jpg"); //载入水牌图片
    $station1 = $_REQUEST['station1']; //定义起点站变量
    $station2 = $_REQUEST['station2']; //定义终点站变量
    $checi = $_REQUEST['checi'];  //定义车次
    $font = "dabiaosong.ttf";  //设置水牌字体
    $black = ImageColorAllocate($shuipai,0,0,0);
    imagettftext($shuipai,20,0,0,0,$black,$font,"BBB");
    Header("Content-type:image/jpeg");
    ImageJPEG($shuipai);
    ImageDestroy($shuipai);
?>注:dabiaosong.ttf与这个PHP文件在同一个目录下,运行这段代码的结果是,只有kuaisu.jpg一张图片,没有BBB三个字符。
请各位大侠帮忙一下,我是新手,谢谢了!

解决方案 »

  1.   

    imagettftext($shuipai,20,0,0,0,$black,$font,"BBB"); 
    20,0,0,0,最后面的两个 不要设置成 0,0  改成其它数字即可array imagettftext ( resource image, float size, float angle, int x, int y, int color, string fontfile, string text )
    x
    由 x,y 所表示的坐标定义了第一个字符的基本点(大概是字符的左下角)。这和 imagestring() 不同,其 x,y 定义了第一个字符的左上角。例如 "top left" 为 0, 0。 y
    Y 坐标。它设定了字体基线的位置,不是字符的最底端。