Skip to content

Commit

Permalink
Merge pull request milon#131 from yasserbelhimer/master
Browse files Browse the repository at this point in the history
replace showCode variable from boolean to integer in getBarcodeHTML m…
  • Loading branch information
milon authored Nov 3, 2021
2 parents 1e8f2f3 + 7a8b594 commit ce66418
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Milon/Barcode/DNS1D.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ protected function getBarcodeSVG($code, $type, $w = 2, $h = 30, $color = 'black'
* @param $w (int) Width of a single bar element in pixels.
* @param $h (int) Height of a single bar element in pixels.
* @param $color (string) Foreground color for bar elements (background is transparent).
* @param $showcode (int) font size of the shown code, default 0.
* @return string HTML code.
* @protected
*/
protected function getBarcodeHTML($code, $type, $w = 2, $h = 30, $color = 'black', $showCode =false) {
protected function getBarcodeHTML($code, $type, $w = 2, $h = 30, $color = 'black', $showCode =0) {
if (!$this->store_path) {
$this->setStorPath(app('config')->get("barcode.store_path"));
}
Expand All @@ -145,7 +146,7 @@ protected function getBarcodeHTML($code, $type, $w = 2, $h = 30, $color = 'black
$bw = round(($v['w'] * $w), 3);
$bh = round(($v['h'] * $h / $this->barcode_array['maxh']), 3);
if($showCode)
$bh -= 12 ;
$bh -= ($showCode + 12);
if ($v['t']) {
$y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3);
// draw a vertical bar
Expand All @@ -154,7 +155,7 @@ protected function getBarcodeHTML($code, $type, $w = 2, $h = 30, $color = 'black
$x += $bw;
}
if($showCode)
$html .= '<div style="position:absolute;bottom:0; text-align:center; width:' . ($this->barcode_array['maxw'] * $w) . 'px; font-size: 0.6vw;">'. $code .'</div>';
$html .= '<div style="position:absolute;bottom:0; text-align:center;color:' . $color . '; width:' . ($this->barcode_array['maxw'] * $w) . 'px; font-size: ' . $showCode . 'px;">' . $code . '</div>';

$html .= '</div>' . "\n";
return $html;
Expand Down

0 comments on commit ce66418

Please sign in to comment.