imagecreate() returns an image identifier representing a blank image of specified size.
PHP imagecreate() function has the following syntax.
resource imagecreate ( int $width , int $height )
PHP imagecreate() function has the following parameters.
Returns an image resource identifier on success, FALSE on errors.
<?php/* ww w .j av a2 s . c o m*/
header("Content-Type: image/png");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
The most basic image script looks like this:
Save the following code as picture.php
<?PHP
$image = imagecreate(400,300);
// do stuff to the image
imagejpeg($image, '', 75);
imagedestroy($image);
?>
Save the following code as viewPicture.htm:
<html>
<body>
<img src="picture1.php" />
</body>
</html>