function BARCODE::genBarCode in Barcode 6
File
- ./
barcode.inc.php, line 135
Class
Code
function genBarCode($barnumber, $format = "gif", $file = "") {
$this
->setFormat($format);
if ($this->_encode == "EAN-13") {
if (strlen($barnumber) > 13) {
$this->_error = "Barcode number must be less then 13 characters.";
return false;
}
$this
->_eanBarcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "UPC-A") {
if (strlen($barnumber) > 12) {
$this->_error = "Barcode number must be less then 13 characters.";
return false;
}
$this
->_eanBarcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "ISBN") {
if (strlen($barnumber) > 13 || strlen($barnumber) < 12) {
$this->_error = "Barcode number must be less then 13 characters.";
return false;
}
elseif (substr($barnumber, 0, 3) != "978") {
$this->_error = "Not an ISBN barcode number. Must be start with 978";
return false;
}
$this
->_eanBarcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "EAN-8") {
if (strlen($barnumber) > 8) {
$this->_error = "Barcode number must be less then 8 characters.";
return false;
}
$this
->_ean8Barcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "UPC-E") {
if (strlen($barnumber) > 12) {
$this->_error = "Barcode number must be less then 12 characters.";
return false;
}
$this
->_upceBarcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "S205" || $this->_encode == "I2O5") {
//STANDARD 2 OF 5 SYMBOLOGY OR INDUSTRIAL 2 OF 5
$this
->_so25Barcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "I25" || $this->_encode == "INTERLEAVED") {
//INTERLEAVED 2 OF 5
$this
->_i25Barcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "POSTNET") {
$this
->_postBarcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "CODABAR") {
$this
->_codaBarcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "CODE128") {
$this
->_c128Barcode($barnumber, $this->_scale, $file);
}
elseif ($this->_encode == "CODE39") {
$this
->_c39Barcode($barnumber, $this->_scale, $file, false);
}
elseif ($this->_encode == "CODE93") {
$this
->_c93Barcode($barnumber, $this->_scale, $file);
}
}