Latest web development tutorials

PHP imagecharup – 垂直地畫一個字符

PHP 圖像處理 PHP圖像處理

imagecharup — 垂直地畫一個字符。

語法

bool imagecharup ( resource $image , int $font , int $x , int $y , string $c , int $color )

imagecharup() 將字符c 垂直地畫在image 指定的圖像上,位於x,y(圖像左上角為0, 0),顏色為color。 如果font 為1,2,3,4 或5,則使用內置的字體。

實例

<?php

$im = imagecreate(100,100);

$string = 'Note that the first letter is a N';

$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// 在白色的背景上输出黑色的 "Z"
imagecharup($im, 3, 10, 10, $string, $black);

header('Content-type: image/png');
imagepng($im);

?>

以上實例輸出結果的圖片如下:

相關文章

PHP 圖像處理 PHP圖像處理