note 60285 deleted from function.imagepolygon by mazzanet
| From: | mazzanet@php.net | Date: | Mon, 02 Jan 2006 08:39:50 +0000 |
| Subject: | note 60285 deleted from function.imagepolygon by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101106@lists.php.net to get a copy of this message | ||
Note Submitter: gerardw at alum dot mit dot edu
----
The example given doesn't seem to actually set the background image (it defaults to black
without being set.)
This slightly modified example draws black on white:
<?php
// create a blank image
$image = imagecreatetruecolor(400, 300);
// fill the background color
$bg = imagecolorallocate($image, 255, 255, 255);
imagefill($image,0,0,$bg); //<-- added this
// choose a color for the polygon
$col_poly = imagecolorallocate($image, 0, 0, 0);
// draw the polygon
imagepolygon($image,
array (
0, 0,
100, 200,
300, 200
),
3,
$col_poly);
// output the picture
header("Content-type: image/png");
imagepng($image);
?>