$colorWhite = imagecolorallocate($image, 255, 255, 255);
$colorBlack = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 0, 0, $colorWhite);
imagestring($image, 4, 10, 10, "Couldn't load image!",
$colorBlack);
header("Content-type: image/jpeg");
imagejpeg($image);
exit();
}
//send image
header("Content-type: image/jpeg");
imagejpeg($image);
?>
integer imagecreatefrompng(string filename)
Use imagecreatefrompng to load a PNG image from a file.
<?
//load an image and display it
$image = imagecreatefrompng("php.png");
header("Content-type: image/png");
imagepng($image);
?>
boolean imagedashedline(integer image, integer start_x,
integer start_y, integer end_x, integer end_y, integer color)
The imagedashedline function draws a dashed line from the start point to the end point.
The color argument is a color identifier returned by imagecolorallocate. Use
imageline to draw a solid line.
Figure 12-3. imagesdashedline.