PHP imagecreatetruecolor () function

Description

imagecreatetruecolor - Create a new true color image.

Syntax

PHP imagecreatetruecolor () function has the following syntax.

resource imagecreatetruecolor ( int $width , int $height )

Parameter

PHP imagecreatetruecolor () function has the following parameters.

  • width - Image width.
  • height - Image height.

Return

Returns an image resource identifier on success, FALSE on errors.

Example


<?php/*from ww w. j  a  v a 2s.  com*/
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);
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions