@@ 124-133 (lines=10) @@ | ||
121 | $svg .= "\t".'<g id="bars" fill="'.$color.'" stroke="none">'."\n"; |
|
122 | // print bars |
|
123 | $x = 0; |
|
124 | foreach ($this->barcode_array['bcode'] as $k => $v) { |
|
125 | $bw = round(($v['w'] * $w), 3); |
|
126 | $bh = round(($v['h'] * $h / $this->barcode_array['maxh']), 3); |
|
127 | if ($v['t']) { |
|
128 | $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); |
|
129 | // draw a vertical bar |
|
130 | $svg .= "\t\t".'<rect x="'.$x.'" y="'.$y.'" width="'.$bw.'" height="'.$bh.'" />'."\n"; |
|
131 | } |
|
132 | $x += $bw; |
|
133 | } |
|
134 | $svg .= "\t".'</g>'."\n"; |
|
135 | $svg .= '</svg>'."\n"; |
|
136 | return $svg; |
|
@@ 151-160 (lines=10) @@ | ||
148 | $html = '<div style="font-size:0;position:relative;width:'.($this->barcode_array['maxw'] * $w).'px;height:'.($h).'px;">'."\n"; |
|
149 | // print bars |
|
150 | $x = 0; |
|
151 | foreach ($this->barcode_array['bcode'] as $k => $v) { |
|
152 | $bw = round(($v['w'] * $w), 3); |
|
153 | $bh = round(($v['h'] * $h / $this->barcode_array['maxh']), 3); |
|
154 | if ($v['t']) { |
|
155 | $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); |
|
156 | // draw a vertical bar |
|
157 | $html .= '<div style="background-color:'.$color.';width:'.$bw.'px;height:'.$bh.'px;position:absolute;left:'.$x.'px;top:'.$y.'px;"> </div>'."\n"; |
|
158 | } |
|
159 | $x += $bw; |
|
160 | } |
|
161 | $html .= '</div>'."\n"; |
|
162 | return $html; |
|
163 | } |