PHP imagepolygon(); Issue

I have read the following webpages on php.net:

http://www.php.net/manual/en/function.imagefilledpolygon.php

&

http://www.php.net/manual/en/function.imagepolygon.php

Plus, the PHP code is the only code in the file, meaning that there is no HTML or other code in there. I cannot figure out how this code does not draw a blue triangle on a white square. What am I doing wrong?

[php]<?php
$im = imagecreate(100, 100);

    //$red = imagecolorallocate($im, 255, 0, 0);
    $white = imagecolorallocate($im, 255, 255, 255);
    $blue = imagecolorallocate($im, 0, 0, 255);

    /*$values = array(
                    0, 0, //Upper left hand corner
                    50, 50 //Center point
                    0, 100 //Bottom left hand corner
                    );*/

    //imagerectangle($im, 0, 0, 100, 100, $white);
    //imagepolygon($im, $values, 3, $blue); //Blue Triangle
    imagepolygon($im, 0, 0, 50, 50, 0, 100, 3, $blue);

    //imagepolygon($im, 0, 0, 50, 50, 0, 100, $blue); //Blue Triangle doesn't work.
    //imagerectangle($im, 0, 0, 50, 50, $blue); //Blue Rectangle works!
    //imageellipse($im, 50, 50, 75, 75, $blue); //Blue Circle works!

    header("Content-type: image/png");
    imagepng($im);
    imagedestroy($im);

?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service