垂直地畫一個字元

imagecharup

(PHP 4, PHP 5, PHP 7, PHP 8)

imagecharup — 垂直地畫一個字元

說明

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

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

示例 #1 imagecharup() 例子

<?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);

// prints a black "Z" on a white background
imagecharup($im, 3, 10, 10, $string, $black);

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

?>

參見 imagechar() 和 imageloadfont()。

Leave a Reply

Your email address will not be published. Required fields are marked *