Answer the question
In order to leave comments, you need to log in
How to draw a polygon in PHP?
Good afternoon! I had a problem when I decided to change the rectangle script
to this image.
Here is the script code itself:
<?
define('PROTECTOR', 1);
@include('files/path.php');
@include($path.'files/db.php');
@include($path.'files/auth.php');
@include($path.'files/func.php');
@include($path.'files/core.php');
@include($path.'files/lvl.php');
$nlvl = $op-$udata[exp];
if($nlvl==0){$nlvl=1;}
$proc=round((($udata[exp]-$ol)/($op-$ol))*100,2);
$max = $op-$ol;
$now = $udata[exp]-$ol;
if($now==0){$now=1;}
$health = 150 / ($max / $now);
$img="pic/exp.gif";
$pic = ImageCreateFromgif($img);
header('Content-Type: image/gif');
$black = imagecolorallocate($pic, 999, 999, 999);
$white = imagecolorallocate($pic, 000, 000, 888);
imagefilledpolygon($pic, array(255,0, 0,24, $health,24, $health,0), 4, $black);
imagestring($pic, 1, 3, 2, ''.$proc.' % ', $white);
imagepolygon($pic, array(0,0, 0,11, 149,11, 149,0), 4, $white);
ob_end_clean();
imagegif($pic);
?>
Answer the question
In order to leave comments, you need to log in
Before asking a question here, it was necessary to think - do you really need to draw a polygon in PHP? :)
Why mess around and draw a button in PHP? You can make it in a graphical editor and then work with it in PHP - overlay labels and so on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question