/** * Print barcode * * @param string $code Code * @param string $encoding Encoding * @param string $scale Scale * @param string $mode 'png' or 'jpg' ... * * * @return array $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) */ function barcode_print($code, $encoding = "ANY", $scale = 2, $mode = "png") { // DOLCHANGE LDR Add log dol_syslog("barcode.lib.php::barcode_print {$code} {$encoding} {$scale} {$mode}"); $bars = barcode_encode($code, $encoding); if (!$bars) { // DOLCHANGE LDR Return error message instead of array $error = 'Bad Value ' . $code . ' for encoding ' . $encoding; dol_syslog('barcode.lib.php::barcode_print ' . $error, LOG_ERR); return $error; } if (!$mode) { $mode = "png"; } //if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']); //elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0); //else barcode_outimage($bars['text'], $bars['bars'], $scale, $mode); return $bars; }
function barcode_print($code, $encoding = '128B', $scale = 2, $mode = 'png') { global $barcode_text; $barcode_text = $code; // encode barcode $bars = barcode_encode($code, $encoding); if ($bars == ENCODING_UNHANDLED) { return false; } // set filetype mode if (!$mode) { $mode = 'png'; } // output the image barcode_outimage($bars['text'], $bars['bars'], $scale, $mode); }
function barcode_print($code, $encoding = "ANY", $scale = 2, $mode = "png", $total_y = 0) { $bars = barcode_encode($code, $encoding); if (!$bars) { return; } if (!$mode) { $mode = "png"; } if (eregi($mode, "^(text|txt|plain)\$")) { print barcode_outtext($bars['text'], $bars['bars']); } elseif (eregi($mode, "^(html|htm)\$")) { print barcode_outhtml($bars['text'], $bars['bars'], $scale, 0, 0); } else { barcode_outimage($bars['text'], $bars['bars'], $scale, $mode, $total_y); } return $bars; }
function barcode_print($code, $encoding = "ANY", $scale = 2, $mode = "png") { $bars = barcode_encode($code, $encoding); if (!$bars) { return; } if (!$mode) { $mode = "png"; } if (preg_match("#^(text|txt|plain)\$#i", $mode)) { print barcode_outtext($bars['text'], $bars['bars']); } elseif (preg_match("#^(html|htm)\$#i", $mode)) { print barcode_outhtml($bars['text'], $bars['bars'], $scale, 0, 0); } else { barcode_outimage($bars['text'], $bars['bars'], $scale, $mode); } return $bars; }
function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png" ){ $bars=barcode_encode($code,$encoding); if (!$bars) return; if (!$mode) $mode="png"; if (eregi($mode,"^(text|txt|plain)$")) print barcode_outtext($bars['text'],$bars['bars']); elseif (eregi($mode,"^(html|htm)$")) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0); else barcode_outimage($bars['text'],$bars['bars'],$scale, $mode); return $bars; }
function barcode_print($code, $encoding, $scale, $mode) { $bars = barcode_encode($code, $encoding); if (!$bars) { return; } if (!$mode) { $mode = "png"; } barcode_outimage($bars['text'], $bars['bars'], $scale, $mode); return $bars; }
function barcode_print($code, $encoding = "ANY", $scale = 2, $mode = "png", $gen_file = false, $files_name = 'barcode', $files_path = './') { $files_path = empty($files_path) ? './' : $files_path; $files_name .= isset($mode) && $mode != '' ? '.' . $mode : '.png'; $files_path .= $files_name; $total_y = 0; $space = ''; $bars = barcode_encode($code, $encoding); if (!$bars) { return; } if (!$mode) { $mode = "png"; } if (preg_match("#^(text|txt|plain)\$#i", $mode)) { print barcode_outtext($bars['text'], $bars['bars']); } elseif (preg_match("#^(html|htm)\$#i", $mode)) { print barcode_outhtml($bars['text'], $bars['bars'], $scale, 0, 0); } else { return barcode_outimage($bars['text'], $bars['bars'], $scale, $mode, $total_y, $space, $gen_file, $files_name, $files_path); } return $bars; }