PHP 中的 imagecreatetruecolor() 函数

phpserver side programmingprogramming

imagecreatetruecolor() 函数用于创建一张新的真彩色图像。

语法

imagecreatetruecolor (width, height)

参数

  • width:图像宽度。

  • height:图像高度。

返回

imagecreatetruecolor() 函数成功时返回图像资源标识符,失败时返回 FALSE。

示例

以下是示例

<?php
   $img = imagecreatetruecolor(600, 500);
   echo imagesy($img);
   echo "<br>";
   echo imagesx($img);
?>

输出

以下输出显示了新图像的高度和宽度:

500
600

示例

让我们看另一个具有不同高度和宽度的示例:

<?php
   $img = imagecreatetruecolor(300, 450);
   echo imagesy($img);
   echo "<br>";
   echo imagesx($img);
?>

输出

以下是显示新图像高度和宽度的输出:

450
300

相关文章