Create polygon and loop
Posted: Tue Dec 02, 2014 2:20 pm
I am drawing polygon using following functions. Code works just fine but I would like to create multiple of them in one HTML page. I have tried looping and changing the $pageHeight every-time it loops. It did not work. Anyone have any idea how I can create multiple of similar polygon using sample script below? I am attaching sample source code and the result. Thank you for help in advance. (Note:this is sample only and would not work if you copy and paste)
Code: Select all
$image = imagecreatetruecolor($paneWidth, $pageHeight);
$background = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $background);
$textColor = imagecolorallocate($image, 0, 0, 0);
drawVector($x_1, $y_1, $x_2, $y_2, $x_3, $y_3, $x_4, $y_4);
imagefilledpolygon($image,$createVector, 4, $polygonFill);
imagestringup($image, 3,($x_1 + $x_2)/2, $y_1-5,$CarrierLabel,$textColor);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);