imagecreatetruecolor - 创建一个新的真彩色图像。

 

语法

PHP imagecreatetruecolor()函数具有以下语法。

resource imagecreatetruecolor ( int $width , int $height )

 

参数

PHP imagecreatetruecolor()函数具有以下参数。

  • width - 图像宽度。
  • height - 图像高度。

 

返回值

成功时返回图像资源标识符,错误时返回FALSE。

 

实例

<?php
/*
http://www.manongjc.com/article/1752.html
作者:码农教程
*/
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);
?>
收藏 打印