|
imagestring (PHP 3, PHP 4, PHP 5) imagestring -- 水平地畫一行字串 說明bool imagestring ( resource image, int font, int x, int y, string s, int col )
imagestring() 用 col
彩色將字串 s 畫到 image
所代表的圖像的 x,y
坐標處(這是字串左上角坐標,整幅圖像的左上角為 0,0)。若果
font 是 1,2,3,4 或 5,則使用內建字型。
例子 1. imagestring() 例子
<?php // 建立一幅 100X30 的圖像 $im = imagecreatetruecolor(100, 30);
// 白色背景和藍色文字 $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 255);
// 把字串寫在圖像左上角 imagestring($im, 5, 0, 0, "Hello world!", $textcolor);
// 輸出圖像 header("Content-type: image/jpeg"); imagejpeg($im); ?>
|
|
參見 imageloadfont() 和
imagettftext()。
| |