PHP imagecreatetruecolor () function

In this chapter you will learn:

  1. What is PHP imagecreatetruecolor () function
  2. Syntax for PHP imagecreatetruecolor () function
  3. Parameter for PHP imagecreatetruecolor () function
  4. Return value for PHP imagecreatetruecolor () function
  5. Example - 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// j  av a  2s.c o m
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);
?>

Next chapter...

What you will learn in the next chapter:

  1. What is PHP imageellipse() function
  2. Syntax for PHP imageellipse() function
  3. Parameter for PHP imageellipse() function
  4. Return value for PHP imageellipse() function
  5. Drawing Circles and Ellipses
  6. Example - PHP imageellipse() function
Home » PHP Tutorial » PHP Image Functions
PHP imagearc() function
PHP imagecreate() function
PHP imagecreatetruecolor () function
PHP imageellipse() function
PHP imagefilledarc() function
PHP imageline() function
PHP imagepolygon() function
PHP imagerectangle() function
PHP imagesetpixel() function
PHP imagettftext() function