imagecreatetruecolor

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

imagecreatetruecolor新建真彩色图像

说明

imagecreatetruecolor(int $width, int $height): GdImage|false

imagecreatetruecolor() 返回图像对象,表示指定大小的黑色图像。

参数

width

图像宽度。

height

图像高度。

返回值

成功后返回图象对象,失败后返回 false

更新日志

版本 说明
8.0.0 成功时,此函数现在返回 GDImage 实例;之前返回 resource

范例

示例 #1 新建 GD 图像流并输出图像。

<?php
header
('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die(
'Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
?>

以上例程的输出类似于:

示例输出:新建 GD 图像流并输出图像。

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top