<?php function hexstr2color($image,$hexstr) { $hexstr="000000".$hexstr; $b=intval(substr($hexstr,-2,2),16); $g=intval(substr($hexstr,-4,2),16); $r=intval(substr($hexstr,-6,2),16); return imagecolorallocate($image,$r,$g,$b); } $intervallengths=TGET('il'); $strlengths=explode(',',$intervallengths); $lengths=array(); $totallength=0; for ($i=0;$i<sizeof($strlengths);$i++) { $len=0+$strlengths[$i]; array_push($lengths,$len); $totallength+=$len; } if ($totallength) { $image=imagecreatetruecolor($totallength,1); $strcolors=explode(',',TGET('clr')); $colors=array(); for ($i=0;$i<sizeof($strcolors);$i++) array_push($colors,hexstr2color($image,$strcolors[$i])); if (!$colors) $colors=array('FFFFFF'); $donelen=0; $coloridx=0; for ($i=0;$i<sizeof($lengths);$i++) { if ($lengths[$i]) { $nextdonelen=$donelen+$lengths[$i]; imagefilledrectangle($image,$donelen,0,$nextdonelen-1,2,$colors[$coloridx]); $donelen=$nextdonelen; } if (++$coloridx>=sizeof($colors)) $coloridx=0; } imagepng($image); imagedestroy($image); } ?>