imagecreatetruecolor

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

imagecreatetruecolorCreate a new true color image

Опис

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

imagecreatetruecolor() returns an image object representing a black image of the specified size.

Параметри

width

Image width.

height

Image height.

Значення, що повертаються

Повертає об'єкт зображення в разі успіху або false в разі помилок.

Журнал змін

Версія Опис
8.0.0 On success, this function returns a GDImage instance now; previously, a resource was returned.

Приклади

Приклад #1 Creating a new GD image stream and outputting an image.

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

Поданий вище приклад виведе щось схоже на:

Output of example : Creating a new GD image stream and outputting an image.

Прогляньте також