Creating and Using Colors
<?php $animage = imagecreate (500, 500); $white = imagecolorallocate ($animage, 255, 255, 255); $black = imagecolorallocate ($animage, 0x00, 0x00, 0x00); imagefilledrectangle ($animage, 0, 0, 500, 500, $black); $blue = imagecolorallocate ($animage, 0, 0, 255); $green = imagecolorallocate ($animage, 0, 255, 0); $title = "title"; imagestring ($animage, 4, 50, 5, $title, $blue); $copy = "information"; imagestring ($animage, 4, 100, 25, $copy, $green); imagepng ($animage); header ("Content-type: image/png"); imagedestroy ($animage); ?>
1. | A simple image using a single color (red) | ||
2. | Allocate image color |