執行該代碼將生成一幅png圖像,并在圖像上顯示hello.
語法:int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col);
返回值:整數
函數種類:圖形處理
內容說明:本函數將圖片的封閉長方形區域著色,參數 x1、y1 及 x2、y2 分別為矩形對角線的坐標,參數 col 表示欲涂上的顏色.
- //發送頭文件
- header("content-type: image/png");
- //創建真彩色圖像
- $im=imagecreatetruecolor(100,50);
- //定義黑色
- $black=imagecolorallocate($im,0,0,0);
- //定義白色
- $white=imagecolorallocate($im,255,255,255);
- //畫一矩形并填充
- imagefilledrectangle($im,0,0,99,49, $white);
- //定義字體
- imagestring($im,2,0,0,"hello",$black);
- //開源代碼Vevb.com
- //輸出圖像
- imagepng($im);
- /*
新聞熱點
疑難解答