1. Import
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test with embedded image</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="test_code39.php?text=Code39 from html" alt="barcode" />
|
||||
</body>
|
||||
</html>
|
||||
7
html/include/barcodegen_php8/example/composer.json
Normal file
7
html/include/barcodegen_php8/example/composer.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"require": {
|
||||
"barcode-bakery/barcode-common": ">=7.0.3",
|
||||
"barcode-bakery/barcode-1d": "7.0.4",
|
||||
"barcode-bakery/gs1ai": ">=1.0"
|
||||
}
|
||||
}
|
||||
BIN
html/include/barcodegen_php8/example/font/Arial.ttf
Normal file
BIN
html/include/barcodegen_php8/example/font/Arial.ttf
Normal file
Binary file not shown.
30
html/include/barcodegen_php8/example/html/BCGcodabar.php
Normal file
30
html/include/barcodegen_php8/example/html/BCGcodabar.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGcodabar');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '$', ':', '/', '.', '+', 'A', 'B', 'C', 'D');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Known also as Ames Code, NW-7, Monarch, 2 of 7, Rationalized Codabar.</li>
|
||||
<li>Codabar was developed in 1972 by Pitney Bowes, Inc.</li>
|
||||
<li>This symbology is useful to encode digital information. It is a self-checking code, there is no check digit.</li>
|
||||
<li>Codabar is used by blood bank, photo labs, library, FedEx...</li>
|
||||
<li>Coding can be with an unspecified length composed by numbers, plus and minus sign, colon, slash, dot, dollar.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
30
html/include/barcodegen_php8/example/html/BCGcode11.php
Normal file
30
html/include/barcodegen_php8/example/html/BCGcode11.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGcode11');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Known also as USD-8.</li>
|
||||
<li>Code 11 was developed in 1977 as a high-density numeric symbology.</li>
|
||||
<li>Used to identify telecommunications equipment.</li>
|
||||
<li>Code 11 is a numeric symbology and its character set consists of 10 digital characters and the dash symbol (-).</li>
|
||||
<li>There is a "C" check digit. If the length of encoded message is greater thant 10, a "K" check digit may be used.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
54
html/include/barcodegen_php8/example/html/BCGcode128.php
Normal file
54
html/include/barcodegen_php8/example/html/BCGcode128.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['start'] = '';
|
||||
$start = isset($_POST['start']) ? $_POST['start'] : $default_value['start'];
|
||||
registerImageKey('start', $start);
|
||||
registerImageKey('code', 'BCGcode128');
|
||||
|
||||
$vals = array();
|
||||
for ($i = 0; $i <= 127; $i++) {
|
||||
$vals[] = '%' . sprintf('%02X', $i);
|
||||
}
|
||||
$characters = array(
|
||||
'NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS', 'TAB', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'DEL'
|
||||
);
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="start">Starts with</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getSelectHtml('start', $start, array('NULL' => 'Auto', 'A' => 'Code 128-A', 'B' => 'Code 128-B', 'C' => 'Code 128-C')); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php $c = count($characters); for ($i = 0; $i < $c; $i++) {
|
||||
echo getButton($characters[$i], $vals[$i]);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Code 128 is a high-density alphanumeric symbology.</li>
|
||||
<li>Used extensively worldwide.</li>
|
||||
<li>Code 128 is designed to encode 128 full ASCII characters.</li>
|
||||
<li>The symbology includes a checksum digit.</li>
|
||||
<li>Code 128A handles capital letters<br />Code 128B handles capital letters and lowercase<br />Code 128C handles group of 2 numbers</li>
|
||||
<li>Your browser may not be able to write the special characters (NUL, SOH, etc.) but you can write them with the code.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
44
html/include/barcodegen_php8/example/html/BCGcode39.php
Normal file
44
html/include/barcodegen_php8/example/html/BCGcode39.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['checksum'] = '';
|
||||
$checksum = isset($_POST['checksum']) ? $_POST['checksum'] : $default_value['checksum'];
|
||||
registerImageKey('checksum', $checksum);
|
||||
registerImageKey('code', 'BCGcode39');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%');
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="checksum">Checksum</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getCheckboxHtml('checksum', $checksum, array('value' => 1)); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Known also as USS Code 39, 3 of 9.</li>
|
||||
<li>Code 39 can encode alphanumeric characters.</li>
|
||||
<li>The symbology is used in non-retail environment.</li>
|
||||
<li>Code 39 is designed to encode 26 upper case letters, 10 digits and 7 special characters.</li>
|
||||
<li>Code 39 has a checksum but it's rarely used.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['checksum'] = '';
|
||||
$checksum = isset($_POST['checksum']) ? $_POST['checksum'] : $default_value['checksum'];
|
||||
registerImageKey('checksum', $checksum);
|
||||
registerImageKey('code', 'BCGcode39extended');
|
||||
|
||||
$vals = array();
|
||||
for ($i = 0; $i <= 127; $i++) {
|
||||
$vals[] = '%' . sprintf('%02X', $i);
|
||||
}
|
||||
$characters = array(
|
||||
'NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS', 'TAB', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'DEL'
|
||||
);
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="checksum">Checksum</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getCheckboxHtml('checksum', $checksum, array('value' => 1)); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php $c = count($characters); for ($i = 0; $i < $c; $i++) {
|
||||
echo getButton($characters[$i], $vals[$i]);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Supports the ASCII 0 to 127.</li>
|
||||
<li>This mode is "optional" for Code 39, you have to specify your reader that you have extended code.</li>
|
||||
<li>Your browser may not be able to write the special characters (NUL, SOH, etc.) but you can write them with the code.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
40
html/include/barcodegen_php8/example/html/BCGcode93.php
Normal file
40
html/include/barcodegen_php8/example/html/BCGcode93.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGcode93');
|
||||
|
||||
$vals = array();
|
||||
for ($i = 0; $i <= 127; $i++) {
|
||||
$vals[] = '%' . sprintf('%02X', $i);
|
||||
}
|
||||
$characters = array(
|
||||
'NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS', 'TAB', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'DEL'
|
||||
);
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php $c = count($characters); for ($i = 0; $i < $c; $i++) {
|
||||
echo getButton($characters[$i], $vals[$i]);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Known also as USS Code 93.</li>
|
||||
<li>Code 93 was designed to provide a higher density and data security enhancement to Code 39.</li>
|
||||
<li>Used primarily by Canadian postal office to encode supplementary delivery information.</li>
|
||||
<li>Similar to Code 39, Code 93 has the same 43 characters plus 5 special ones to encode the ASCII 0 to 127.</li>
|
||||
<li>This symbology composed of 2 check digits ("C" and "K").</li>
|
||||
<li>Your browser may not be able to write the special characters (NUL, SOH, etc.) but you can write them with the code.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
29
html/include/barcodegen_php8/example/html/BCGean13.php
Normal file
29
html/include/barcodegen_php8/example/html/BCGean13.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGean13');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>EAN means Internal Article Numbering.</li>
|
||||
<li>It is an extension of UPC-A to include the country information.</li>
|
||||
<li>Used with consumer products internationally.</li>
|
||||
<li>Composed by 2 number system, 5 manufacturer code, 5 product code and 1 check digit.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
28
html/include/barcodegen_php8/example/html/BCGean8.php
Normal file
28
html/include/barcodegen_php8/example/html/BCGean8.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGean8');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>EAN-8 is a short version of EAN-13.</li>
|
||||
<li>Composed by 7 digits and 1 check digit.</li>
|
||||
<li>There is no conversion available between EAN-8 and EAN-13.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
144
html/include/barcodegen_php8/example/html/BCGgs1128.php
Normal file
144
html/include/barcodegen_php8/example/html/BCGgs1128.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['start'] = 'C';
|
||||
$start = isset($_POST['start']) ? $_POST['start'] : $default_value['start'];
|
||||
registerImageKey('start', $start);
|
||||
|
||||
$identifiers = new stdClass;
|
||||
$identifiers->{''} = 'Select an identifier';
|
||||
|
||||
if (class_exists('BarcodeBakery\Common\GS1\GS1AI')) {
|
||||
foreach (BarcodeBakery\Common\GS1\GS1AI::getDefaultAIData() as $aiData) {
|
||||
$identifiers->{$aiData->getAI()} = $aiData->getAI() . ' - ' . $aiData->getDescription();
|
||||
}
|
||||
} else {
|
||||
$identifiers->{'0'} = 'Load the package barcode-bakery/gs1ai to populate this list.';
|
||||
}
|
||||
|
||||
registerImageKey('code', 'BCGgs1128');
|
||||
|
||||
$vals = array();
|
||||
for ($i = 0; $i <= 127; $i++) {
|
||||
$vals[] = '%' . sprintf('%02X', $i);
|
||||
}
|
||||
$characters = array(
|
||||
'NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS', 'TAB', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'DEL'
|
||||
);
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="start">Starts with</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getSelectHtml('start', $start, array('NULL' => 'Auto', 'A' => 'Code 128-A', 'B' => 'Code 128-B', 'C' => 'Code 128-C')); ?>
|
||||
</div>
|
||||
</li>
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="identifier">Identifiers</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getSelectHtml('identifier', null, $identifiers, array('style' => 'width: 100%')); ?>
|
||||
<div id="identifierContainer"></div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php $c = count($characters); for ($i = 0; $i < $c; $i++) {
|
||||
echo getButton($characters[$i], $vals[$i]);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Encoded as Code 128.</li>
|
||||
<li>The former correct name was UCC/EAN-128.</li>
|
||||
<li>Used for shipping containers.</li>
|
||||
<li>Based on the GS1 standard.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
var identifierSelect = $("#identifier"),
|
||||
identifierContainer = $("#identifierContainer"),
|
||||
generateText = $("#text");
|
||||
|
||||
var updateText = function() {
|
||||
var text = "";
|
||||
$(".gs1128_identifier").each(function() {
|
||||
var $this = $(this);
|
||||
text += "(" + $this.find(".gs1128_id").val() + ")" + $this.find(".gs1128_value").val() + "~F1";
|
||||
});
|
||||
text = text.substring(0, text.length - 3);
|
||||
generateText.val(text);
|
||||
};
|
||||
|
||||
var addIdentifier = function(id) {
|
||||
var identifier = $("<div class='gs1128_identifier'><input type='text' value='" + id + "' class='gs1128_id' readonly='readonly' /> - <input type='text' class='gs1128_value' /><a href='#' class='gs1128_delete'><img src='delete.png' alt='Delete' /></a></div>")
|
||||
.appendTo(identifierContainer)
|
||||
|
||||
identifier.find(".gs1128_delete").on("click", function() {
|
||||
$(this).closest(".gs1128_identifier").remove();
|
||||
updateText();
|
||||
return false;
|
||||
});
|
||||
identifier.find(".gs1128_value").on("keyup", function() {
|
||||
updateText();
|
||||
});
|
||||
|
||||
identifierSelect.val();
|
||||
return;
|
||||
};
|
||||
|
||||
identifierSelect.change(function() {
|
||||
addIdentifier($(this).find("option:selected").val());
|
||||
updateText();
|
||||
});
|
||||
|
||||
generateText.on("keyup", function() {
|
||||
var val = $(this).val(),
|
||||
section = val.split("~F1"),
|
||||
i = 0, regex = /^\(([0-9]*y?)\)(.*)$/,
|
||||
result;
|
||||
|
||||
// Let's remove all identifiers we put already
|
||||
$(".gs1128_identifier").remove();
|
||||
for (i = 0; i < section.length; i++) {
|
||||
// we are able to handle only if you have ()
|
||||
result = regex.exec(section[i]);
|
||||
if (result.length === 3) {
|
||||
addIdentifier(result[1]);
|
||||
$(".gs1128_identifier").eq(i).find(".gs1128_value").val(result[2]);
|
||||
} else {
|
||||
// Oups, you entered something wrong...
|
||||
$(".gs1128_identifier").remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
if (generateText.val() !== "") {
|
||||
generateText.keyup();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
41
html/include/barcodegen_php8/example/html/BCGi25.php
Normal file
41
html/include/barcodegen_php8/example/html/BCGi25.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['checksum'] = '';
|
||||
$checksum = isset($_POST['checksum']) ? $_POST['checksum'] : $default_value['checksum'];
|
||||
registerImageKey('checksum', $checksum);
|
||||
registerImageKey('code', 'BCGi25');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="checksum">Checksum</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getCheckboxHtml('checksum', $checksum, array('value' => 1)); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Interleaved 2 of 5 is based on Standard 2 of 5 symbology.</li>
|
||||
<li>There is an optional checksum.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
105
html/include/barcodegen_php8/example/html/BCGintelligentmail.php
Normal file
105
html/include/barcodegen_php8/example/html/BCGintelligentmail.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
if (!function_exists('bcadd')) {
|
||||
exit('The mathematical extension bcmath is not installed on your server.');
|
||||
}
|
||||
|
||||
$default_value['barcodeIdentifier'] = '';
|
||||
$barcodeIdentifier = isset($_POST['barcodeIdentifier']) ? $_POST['barcodeIdentifier'] : $default_value['barcodeIdentifier'];
|
||||
registerImageKey('barcodeIdentifier', $barcodeIdentifier);
|
||||
|
||||
$default_value['serviceType'] = '';
|
||||
$serviceType = isset($_POST['serviceType']) ? $_POST['serviceType'] : $default_value['serviceType'];
|
||||
registerImageKey('serviceType', $serviceType);
|
||||
|
||||
$default_value['mailerIdentifier'] = '';
|
||||
$mailerIdentifier = isset($_POST['mailerIdentifier']) ? $_POST['mailerIdentifier'] : $default_value['mailerIdentifier'];
|
||||
registerImageKey('mailerIdentifier', $mailerIdentifier);
|
||||
|
||||
$default_value['serialNumber'] = '';
|
||||
$serialNumber = isset($_POST['serialNumber']) ? $_POST['serialNumber'] : $default_value['serialNumber'];
|
||||
registerImageKey('serialNumber', $serialNumber);
|
||||
|
||||
registerImageKey('code', 'BCGintelligentmail');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="barcodeIdentifier">Barcode Identifier</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getInputTextHtml('barcodeIdentifier', $barcodeIdentifier, array('type' => 'text', 'maxlength' => 2, 'required' => 'required')); ?>
|
||||
</div>
|
||||
</li>
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="serviceType">Service Type</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getInputTextHtml('serviceType', $serviceType, array('type' => 'text', 'maxlength' => 3, 'required' => 'required')); ?>
|
||||
</div>
|
||||
</li>
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="mailerIdentifier">Mailer Identifier</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getInputTextHtml('mailerIdentifier', $mailerIdentifier, array('type' => 'text', 'maxlength' => 9, 'required' => 'required')); ?>
|
||||
</div>
|
||||
</li>
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="serialNumber">Serial Number</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getInputTextHtml('serialNumber', $serialNumber, array('type' => 'text', 'maxlength' => 9, 'required' => 'required')); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Used to encode enveloppe in USA.</li>
|
||||
<li>
|
||||
You can provide
|
||||
<br />5 digits (ZIP Code)
|
||||
<br />9 digits (ZIP+4 code)
|
||||
<br />11 digits (ZIP+4 code+2 digits)
|
||||
</li>
|
||||
<li>Contains a barcode identifier, service type identifier, mailer id and serial number.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
$(function() {
|
||||
var thickness = $("#thickness")
|
||||
.val(9)
|
||||
.removeAttr("min step")
|
||||
.prop("disabled", true);
|
||||
|
||||
$("form").on("submit", function() {
|
||||
thickness.prop("disabled", false);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
29
html/include/barcodegen_php8/example/html/BCGisbn.php
Normal file
29
html/include/barcodegen_php8/example/html/BCGisbn.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGisbn');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>ISBN stands for International Standard Book Number.</li>
|
||||
<li>ISBN type is based on EAN-13.</li>
|
||||
<li>Previously, all ISBN were in EAN-10 format. EAN-13 uses the same encoding but may contain different data in the ISBN number.</li>
|
||||
<li>Composed by a GS1 prefix (for ISBN-13), a group identifier, a publisher code, an item number and a check digit.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
41
html/include/barcodegen_php8/example/html/BCGmsi.php
Normal file
41
html/include/barcodegen_php8/example/html/BCGmsi.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['checksum'] = '0';
|
||||
$checksum = isset($_POST['checksum']) ? $_POST['checksum'] : $default_value['checksum'];
|
||||
registerImageKey('checksum', $checksum);
|
||||
registerImageKey('code', 'BCGmsi');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="checksum">Checksum</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getInputTextHtml('checksum', $checksum, array('type' => 'number', 'min' => 0, 'max' => 2)); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Developed by the MSI Data Corporation.</li>
|
||||
<li>Used primarily to mark retail shelves for inventory control.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
41
html/include/barcodegen_php8/example/html/BCGothercode.php
Normal file
41
html/include/barcodegen_php8/example/html/BCGothercode.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['label'] = '';
|
||||
$label = isset($_POST['label']) ? $_POST['label'] : $default_value['label'];
|
||||
registerImageKey('label', $label);
|
||||
registerImageKey('code', 'BCGothercode');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="label">Label</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getInputTextHtml('label', $label); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Enter width of each bars with one characters. Begin by a bar.</li>
|
||||
<li>10523: Will do 2px bar, 1px space, 6px bar, 3px space, 4px bar.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
50
html/include/barcodegen_php8/example/html/BCGpostnet.php
Normal file
50
html/include/barcodegen_php8/example/html/BCGpostnet.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGpostnet');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Used to encode enveloppe in USA.</li>
|
||||
<li>
|
||||
You can provide
|
||||
<br />5 digits (ZIP Code)
|
||||
<br />9 digits (ZIP+4 code)
|
||||
<br />11 digits (ZIP+4 code+2 digits)
|
||||
<br />(Those 2 digits are taken from your address. If your address is 6453, the code will be 53.)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
$(function() {
|
||||
var thickness = $("#thickness")
|
||||
.val(9)
|
||||
.removeAttr("min step")
|
||||
.prop("disabled", true);
|
||||
|
||||
$("form").on("submit", function() {
|
||||
thickness.prop("disabled", false);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
43
html/include/barcodegen_php8/example/html/BCGs25.php
Normal file
43
html/include/barcodegen_php8/example/html/BCGs25.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
$default_value['checksum'] = '';
|
||||
$checksum = isset($_POST['checksum']) ? $_POST['checksum'] : $default_value['checksum'];
|
||||
registerImageKey('checksum', $checksum);
|
||||
registerImageKey('code', 'BCGs25');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<ul id="specificOptions">
|
||||
<li class="option">
|
||||
<div class="title">
|
||||
<label for="checksum">Checksum</label>
|
||||
</div>
|
||||
<div class="value">
|
||||
<?php echo getCheckboxHtml('checksum', $checksum, array('value' => 1)); ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Known also as Industrial 2 of 5.</li>
|
||||
<li>Standard 2 of 5 is a low-density numeric symbology that has been with us since the 1960s.</li>
|
||||
<li>There is an optional checksum.</li>
|
||||
<li>Note: Standard 2 of 5 is really tough to read!</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
38
html/include/barcodegen_php8/example/html/BCGupca.php
Normal file
38
html/include/barcodegen_php8/example/html/BCGupca.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGupca');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Encoded as EAN-13.</li>
|
||||
<li>Most common and well-known in the USA.</li>
|
||||
<li>There is 1 number system (NS), 5 manufacturer code, 5 product code and 1 check digit.</li>
|
||||
<li>
|
||||
NS Description :
|
||||
<br />0 = Regular UPC Code
|
||||
<br />2 = Weight Items
|
||||
<br />3 = Drug/Health Items
|
||||
<br />4 = In-Store Use on Non-Food Items
|
||||
<br />5 = Coupons
|
||||
<br />7 = Regular UPC Code
|
||||
<br />And other are Reserved.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
29
html/include/barcodegen_php8/example/html/BCGupce.php
Normal file
29
html/include/barcodegen_php8/example/html/BCGupce.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGupce');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Short version of UPC symbol, 8 characters.</li>
|
||||
<li>It is a conversion of an UPC-A for small package.</li>
|
||||
<li>You can provide directly an UPC-A (11 chars) or UPC-E (6 chars) code.</li>
|
||||
<li>UPC-E contain a system number and a check digit.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
27
html/include/barcodegen_php8/example/html/BCGupcext2.php
Normal file
27
html/include/barcodegen_php8/example/html/BCGupcext2.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGupcext2');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Extension for UPC-A, UPC-E, EAN-13 and EAN-8.</li>
|
||||
<li>Used for encode additional information for newspaper, books...</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
35
html/include/barcodegen_php8/example/html/BCGupcext5.php
Normal file
35
html/include/barcodegen_php8/example/html/BCGupcext5.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
define('IN_CB', true);
|
||||
include('include/header.php');
|
||||
|
||||
registerImageKey('code', 'BCGupcext5');
|
||||
|
||||
$characters = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
?>
|
||||
|
||||
<div id="validCharacters">
|
||||
<h3>Valid Characters</h3>
|
||||
<?php foreach ($characters as $character) {
|
||||
echo getButton($character);
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<div id="explanation">
|
||||
<h3>Explanation</h3>
|
||||
<ul>
|
||||
<li>Extension for UPC-A, UPC-E, EAN-13 and EAN-8.</li>
|
||||
<li>Used to encode suggested retail price.</li>
|
||||
<li>If the first number is a 0, the price xx.xx is expressed in British Pounds. If it is a 5, it is expressed in US dollars.</li>
|
||||
<li>
|
||||
Special Code Description:
|
||||
<br />90000: No suggested retail price
|
||||
<br />99991: The item is a complementary of another one. Normally free
|
||||
<br />99990: Used bh National Association of College Stores to mark "used book"
|
||||
<br />90001 to 98999: Internal purposes for some publishers
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('include/footer.php');
|
||||
?>
|
||||
120
html/include/barcodegen_php8/example/html/barcode.js
Normal file
120
html/include/barcodegen_php8/example/html/barcode.js
Normal file
@@ -0,0 +1,120 @@
|
||||
$(function() {
|
||||
var attachMainBehaviors = function() {
|
||||
$("select[name=type]").on("change", function() {
|
||||
var selected = $(this).find("option:selected");
|
||||
window.location.href = selected.val();
|
||||
});
|
||||
|
||||
$("select[name=filetype]").on("change", function() {
|
||||
var selected = $(this).find("option:selected"),
|
||||
val = selected.val(),
|
||||
dpi = $("input[name=dpi]"),
|
||||
dpiUnavailable = $("#dpiUnavailable");
|
||||
|
||||
if (val === "PNG" || val === "JPEG") {
|
||||
dpi.prop("disabled", false);
|
||||
dpiUnavailable.hide();
|
||||
} else {
|
||||
dpi.prop("disabled", true);
|
||||
dpiUnavailable.show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
var text = $("input[name=text]");
|
||||
|
||||
$("#validCharacters").on("click", "[data-output]", function() {
|
||||
var $this = $(this),
|
||||
escaped = $this.data("escaped"),
|
||||
value = $this.data("output");
|
||||
if (escaped) {
|
||||
value = unescape(value);
|
||||
}
|
||||
|
||||
text
|
||||
.val(text.val() + value)
|
||||
.focus();
|
||||
});
|
||||
}, attachUIBehaviors = function() {
|
||||
$("table").each(function() {
|
||||
var $this = $(this);
|
||||
$this.find("tr:even").addClass("even");
|
||||
$this.find("tr:odd").addClass("odd");
|
||||
});
|
||||
}, attachSpecificBehaviors = function() {
|
||||
$("#specificOptions li").each(function() {
|
||||
var $this = $(this),
|
||||
code = $("<tr><td class='title'></td><td class='value'></td></tr>");
|
||||
code.find(".title").append($this.find(".title"));
|
||||
code.find(".value").append($this.find(".value"));
|
||||
|
||||
$("div.configurations tr:last").before(code);
|
||||
});
|
||||
}, attachInfoBehaviors = function() {
|
||||
var showTooltip = function(object) {
|
||||
object
|
||||
.on("mouseover", function() {
|
||||
var timer = $(this).data("timer");
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
})
|
||||
.on("mouseout", function() {
|
||||
var that = $(this);
|
||||
that.data("timer", setTimeout(function() {
|
||||
that.removeClass("visible");
|
||||
}, 1000));
|
||||
});
|
||||
|
||||
return function() {
|
||||
var $this = $(this),
|
||||
offset = $this.offset(),
|
||||
timer = object.data("timer");
|
||||
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
|
||||
// Show it once so we can get the outerWidth properly
|
||||
object
|
||||
.css({
|
||||
left: -99999,
|
||||
top: -99999
|
||||
})
|
||||
.addClass("visible")
|
||||
.css({
|
||||
left: offset.left + $this.width() - object.outerWidth(),
|
||||
top: offset.top + $this.height()
|
||||
});
|
||||
return false;
|
||||
};
|
||||
},
|
||||
hideTooltip = function(object) {
|
||||
return function() {
|
||||
object.data("timer", setTimeout(function() {
|
||||
object.removeClass("visible");
|
||||
}, 1000));
|
||||
};
|
||||
},
|
||||
bubbleize = function(object) {
|
||||
return object
|
||||
.addClass("bubble")
|
||||
.attr("role", "tooltip")
|
||||
.appendTo(document.body);
|
||||
},
|
||||
explanation = bubbleize($("#explanation")),
|
||||
validCharacters = bubbleize($("#validCharacters"));
|
||||
|
||||
$(".info.explanation")
|
||||
.on("mouseover focusin", showTooltip(explanation))
|
||||
.on("mouseout focusout", hideTooltip(explanation));
|
||||
|
||||
$(".info.characters")
|
||||
.on("mouseover focusin", showTooltip(validCharacters))
|
||||
.on("mouseout focusout", hideTooltip(validCharacters));
|
||||
};
|
||||
|
||||
attachSpecificBehaviors();
|
||||
attachMainBehaviors();
|
||||
attachUIBehaviors();
|
||||
attachInfoBehaviors();
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
use BarcodeBakery\Common\BCGFontFile;
|
||||
|
||||
function baseCustomSetup($barcode, $get)
|
||||
{
|
||||
$font_dir = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'font';
|
||||
|
||||
if (isset($get['thickness'])) {
|
||||
$barcode->setThickness(max(9, min(90, intval($get['thickness']))));
|
||||
}
|
||||
|
||||
$font = 0;
|
||||
if ($get['font_family'] !== '0' && intval($get['font_size']) >= 1) {
|
||||
$font = new BCGFontFile($font_dir . '/' . $get['font_family'], intval($get['font_size']));
|
||||
}
|
||||
|
||||
$barcode->setFont($font);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGcodabar.php';
|
||||
$className = 'BCGcodabar';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGcode11.php';
|
||||
$className = 'BCGcode11';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGcode128.php';
|
||||
$className = 'BCGcode128';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['start'])) {
|
||||
$barcode->setStart($get['start'] === 'NULL' ? null : $get['start']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGcode39.php';
|
||||
$className = 'BCGcode39';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['checksum'])) {
|
||||
$barcode->setChecksum($get['checksum'] === '1' ? true : false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGcode39extended.php';
|
||||
$className = 'BCGcode39extended';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['checksum'])) {
|
||||
$barcode->setChecksum($get['checksum'] === '1' ? true : false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGcode93.php';
|
||||
$className = 'BCGcode93';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGean13.php';
|
||||
$className = 'BCGean13';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGean8.php';
|
||||
$className = 'BCGean8';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$classFile = 'BCGgs1128.php';
|
||||
$className = 'BCGgs1128';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['start'])) {
|
||||
$barcode->setStart($get['start'] === 'NULL' ? null : $get['start']);
|
||||
}
|
||||
|
||||
$barcode->setApplicationIdentifiers(BarcodeBakery\Common\GS1\GS1AI::getDefaultAIData());
|
||||
}
|
||||
12
html/include/barcodegen_php8/example/html/config/BCGi25.php
Normal file
12
html/include/barcodegen_php8/example/html/config/BCGi25.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGi25.php';
|
||||
$className = 'BCGi25';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['checksum'])) {
|
||||
$barcode->setChecksum($get['checksum'] === '1' ? true : false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGintelligentmail.php';
|
||||
$className = 'BCGintelligentmail';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['barcodeIdentifier']) && isset($get['serviceType']) && isset($get['mailerIdentifier']) && isset($get['serialNumber'])) {
|
||||
$barcode->setTrackingCode(intval($get['barcodeIdentifier']), intval($get['serviceType']), intval($get['mailerIdentifier']), intval($get['serialNumber']));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGisbn.php';
|
||||
$className = 'BCGisbn';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
12
html/include/barcodegen_php8/example/html/config/BCGmsi.php
Normal file
12
html/include/barcodegen_php8/example/html/config/BCGmsi.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGmsi.php';
|
||||
$className = 'BCGmsi';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['checksum'])) {
|
||||
$barcode->setChecksum($get['checksum']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGothercode.php';
|
||||
$className = 'BCGothercode';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['label'])) {
|
||||
$barcode->setLabel($get['label']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGpostnet.php';
|
||||
$className = 'BCGpostnet';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
12
html/include/barcodegen_php8/example/html/config/BCGs25.php
Normal file
12
html/include/barcodegen_php8/example/html/config/BCGs25.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$classFile = 'BCGs25.php';
|
||||
$className = 'BCGs25';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
|
||||
function customSetup($barcode, $get)
|
||||
{
|
||||
if (isset($get['checksum'])) {
|
||||
$barcode->setChecksum($get['checksum'] === '1' ? true : false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGupca.php';
|
||||
$className = 'BCGupca';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGupce.php';
|
||||
$className = 'BCGupce';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGupcext2.php';
|
||||
$className = 'BCGupcext2';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$classFile = 'BCGupcext5.php';
|
||||
$className = 'BCGupcext5';
|
||||
$baseClassFile = 'BCGBarcode1D.php';
|
||||
$codeVersion = '7.0.4';
|
||||
BIN
html/include/barcodegen_php8/example/html/delete.png
Normal file
BIN
html/include/barcodegen_php8/example/html/delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 438 B |
BIN
html/include/barcodegen_php8/example/html/error.png
Normal file
BIN
html/include/barcodegen_php8/example/html/error.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
html/include/barcodegen_php8/example/html/favicon.ico
Normal file
BIN
html/include/barcodegen_php8/example/html/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 288 B |
96
html/include/barcodegen_php8/example/html/image.php
Normal file
96
html/include/barcodegen_php8/example/html/image.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
require __DIR__ . '../../vendor/autoload.php';
|
||||
|
||||
use BarcodeBakery\Common\BCGColor;
|
||||
use BarcodeBakery\Common\BCGDrawing;
|
||||
use BarcodeBakery\Common\BCGFontFile;
|
||||
use BarcodeBakery\Common\BCGLabel;
|
||||
|
||||
define('IN_CB', true);
|
||||
include_once('include/function.php');
|
||||
|
||||
function showError()
|
||||
{
|
||||
header('Content-Type: image/png');
|
||||
readfile('error.png');
|
||||
exit;
|
||||
}
|
||||
|
||||
$requiredKeys = array('code', 'filetype', 'dpi', 'scale', 'rotation', 'font_family', 'font_size', 'text');
|
||||
|
||||
// Check if everything is present in the request
|
||||
foreach ($requiredKeys as $key) {
|
||||
if (!isset($_GET[$key])) {
|
||||
showError();
|
||||
}
|
||||
}
|
||||
|
||||
if (!preg_match('/^[A-Za-z0-9]+$/', $_GET['code'])) {
|
||||
showError();
|
||||
}
|
||||
|
||||
$code = $_GET['code'];
|
||||
|
||||
// Check if the code is valid
|
||||
if (!file_exists('config' . DIRECTORY_SEPARATOR . $code . '.php')) {
|
||||
showError();
|
||||
}
|
||||
|
||||
include_once('config' . DIRECTORY_SEPARATOR . $code . '.php');
|
||||
|
||||
include_once('config' . DIRECTORY_SEPARATOR . $baseClassFile);
|
||||
|
||||
$filetypes = array('PNG' => BCGDrawing::IMG_FORMAT_PNG, 'JPEG' => BCGDrawing::IMG_FORMAT_JPEG, 'GIF' => BCGDrawing::IMG_FORMAT_GIF);
|
||||
$finalClassName = 'BarcodeBakery\\Barcode\\' . $className;
|
||||
|
||||
$drawException = null;
|
||||
$barcode = null;
|
||||
try {
|
||||
$colorBlack = new BCGColor(0, 0, 0);
|
||||
$colorWhite = new BCGColor(255, 255, 255);
|
||||
|
||||
$code_generated = new $finalClassName();
|
||||
|
||||
if (function_exists('baseCustomSetup')) {
|
||||
baseCustomSetup($code_generated, $_GET);
|
||||
}
|
||||
|
||||
if (function_exists('customSetup')) {
|
||||
customSetup($code_generated, $_GET);
|
||||
}
|
||||
|
||||
$code_generated->setScale(max(1, $_GET['scale']));
|
||||
$code_generated->setBackgroundColor($colorWhite);
|
||||
$code_generated->setForegroundColor($colorBlack);
|
||||
|
||||
if ($_GET['text'] !== '') {
|
||||
$text = convertText($_GET['text']);
|
||||
$code_generated->parse($text);
|
||||
}
|
||||
|
||||
$barcode = $code_generated;
|
||||
} catch (\Exception $exception) {
|
||||
$drawException = $exception;
|
||||
}
|
||||
|
||||
$drawing = new BCGDrawing($barcode, $colorWhite);
|
||||
if ($drawException) {
|
||||
$drawing->drawException($drawException);
|
||||
} else {
|
||||
$drawing->setRotationAngle($_GET['rotation']);
|
||||
$drawing->setDPI($_GET['dpi'] === 'NULL' ? null : max(72, min(300, intval($_GET['dpi']))));
|
||||
}
|
||||
|
||||
switch ($_GET['filetype']) {
|
||||
case 'PNG':
|
||||
header('Content-Type: image/png');
|
||||
break;
|
||||
case 'JPEG':
|
||||
header('Content-Type: image/jpeg');
|
||||
break;
|
||||
case 'GIF':
|
||||
header('Content-Type: image/gif');
|
||||
break;
|
||||
}
|
||||
|
||||
$drawing->finish($filetypes[$_GET['filetype']]);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if (!defined('IN_CB')) {
|
||||
die('You are not allowed to access to this page.');
|
||||
}
|
||||
|
||||
$default_value['thickness'] = 30;
|
||||
$thickness = intval(isset($_POST['thickness']) ? $_POST['thickness'] : $default_value['thickness']);
|
||||
registerImageKey('thickness', $thickness);
|
||||
?>
|
||||
<tr>
|
||||
<td><label for="thickness">Thickness</label></td>
|
||||
<td><?php echo getInputTextHtml('thickness', $thickness, array('type' => 'number', 'min' => 20, 'max' => 90, 'step' => 5, 'required' => 'required')); ?></td>
|
||||
</tr>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// We could be more dynamic and open each file to find its name
|
||||
// But that would hinder the performance
|
||||
$supportedBarcodes = array(
|
||||
// 1D
|
||||
'BCGcodabar.php' => 'Codabar',
|
||||
'BCGcode11.php' => 'Code 11',
|
||||
'BCGcode39.php' => 'Code 39',
|
||||
'BCGcode39extended.php' => 'Code 39 Extended',
|
||||
'BCGcode93.php' => 'Code 93',
|
||||
'BCGcode128.php' => 'Code 128',
|
||||
'BCGean8.php' => 'EAN-8',
|
||||
'BCGean13.php' => 'EAN-13',
|
||||
'BCGgs1128.php' => 'GS1-128 (EAN-128)',
|
||||
'BCGisbn.php' => 'ISBN',
|
||||
'BCGi25.php' => 'Interleaved 2 of 5',
|
||||
'BCGs25.php' => 'Standard 2 of 5',
|
||||
'BCGmsi.php' => 'MSI Plessey',
|
||||
'BCGupca.php' => 'UPC-A',
|
||||
'BCGupce.php' => 'UPC-E',
|
||||
'BCGupcext2.php' => 'UPC Extenstion 2 Digits',
|
||||
'BCGupcext5.php' => 'UPC Extenstion 5 Digits',
|
||||
'BCGpostnet.php' => 'Postnet',
|
||||
'BCGintelligentmail.php' => 'Intelligent Mail',
|
||||
'BCGothercode.php' => 'Other Barcode',
|
||||
|
||||
// Databar
|
||||
'BCGdatabarexpanded.php' => 'Databar Expanded',
|
||||
'BCGdatabarlimited.php' => 'Databar Limited',
|
||||
'BCGdatabaromni.php' => 'Databar Omni',
|
||||
|
||||
// 2D
|
||||
'BCGaztec.php' => 'Aztec',
|
||||
'BCGdatamatrix.php' => 'DataMatrix',
|
||||
'BCGmaxicode.php' => 'MaxiCode',
|
||||
'BCGpdf417.php' => 'PDF417',
|
||||
'BCGqrcode.php' => 'QRCode'
|
||||
);
|
||||
37
html/include/barcodegen_php8/example/html/include/footer.php
Normal file
37
html/include/barcodegen_php8/example/html/include/footer.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if (!defined('IN_CB')) {
|
||||
die('You are not allowed to access to this page.');
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="output">
|
||||
<section class="output">
|
||||
<h3>Output</h3>
|
||||
<?php
|
||||
$finalRequest = '';
|
||||
foreach (getImageKeys() as $key => $value) {
|
||||
$finalRequest .= '&' . $key . '=' . urlencode($value);
|
||||
}
|
||||
if (strlen($finalRequest) > 0) {
|
||||
$finalRequest[0] = '?';
|
||||
}
|
||||
?>
|
||||
<div id="imageOutput">
|
||||
<?php if ($imageKeys['text'] !== '') {
|
||||
?><img src="image.php<?php echo $finalRequest; ?>" alt="Barcode Image" /><?php
|
||||
} else {
|
||||
?>Fill the form to generate a barcode.<?php
|
||||
} ?>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="footer">
|
||||
<footer>
|
||||
All Rights Reserved © <?php date_default_timezone_set('UTC'); echo date('Y'); ?> <a href="http://www.barcodebakery.com" target="_blank">Barcode Bakery</a>
|
||||
<br /><?php echo $code; ?> PHP-v<?php echo $codeVersion; ?>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
184
html/include/barcodegen_php8/example/html/include/function.php
Normal file
184
html/include/barcodegen_php8/example/html/include/function.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
if (!defined('IN_CB')) {
|
||||
die('You are not allowed to access to this page.');
|
||||
}
|
||||
|
||||
$imageKeys = array();
|
||||
function registerImageKey($key, $value)
|
||||
{
|
||||
global $imageKeys;
|
||||
$imageKeys[$key] = $value;
|
||||
}
|
||||
|
||||
function getImageKeys()
|
||||
{
|
||||
global $imageKeys;
|
||||
return $imageKeys;
|
||||
}
|
||||
|
||||
function getElementHtml($tag, $attributes, $content = false)
|
||||
{
|
||||
$code = '<' . $tag;
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$code .= ' ' . $attribute . '="' . htmlentities(stripslashes($value), ENT_COMPAT) . '"';
|
||||
}
|
||||
|
||||
if ($content === false || $content === null) {
|
||||
$code .= ' />';
|
||||
} else {
|
||||
$code .= '>' . $content . '</' . $tag . '>';
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
function getInputTextHtml($name, $currentValue, $attributes = array())
|
||||
{
|
||||
$defaultAttributes = array(
|
||||
'id' => $name,
|
||||
'name' => $name
|
||||
);
|
||||
|
||||
$finalAttributes = array_merge($defaultAttributes, $attributes);
|
||||
if ($currentValue !== null) {
|
||||
$finalAttributes['value'] = $currentValue;
|
||||
}
|
||||
|
||||
return getElementHtml('input', $finalAttributes, false);
|
||||
}
|
||||
|
||||
function getOptionGroup($options, $currentValue)
|
||||
{
|
||||
$content = '';
|
||||
foreach ($options as $optionKey => $optionValue) {
|
||||
if (is_array($optionValue)) {
|
||||
$content .= '<optgroup label="' . $optionKey . '">' . getOptionGroup($optionValue, $currentValue) . '</optgroup>';
|
||||
} else {
|
||||
$optionAttributes = array();
|
||||
if ($currentValue == $optionKey) { // Keep weak
|
||||
$optionAttributes['selected'] = 'selected';
|
||||
}
|
||||
$content .= getOptionHtml($optionKey, $optionValue, $optionAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function getOptionHtml($value, $content, $attributes = array())
|
||||
{
|
||||
$defaultAttributes = array(
|
||||
'value' => $value
|
||||
);
|
||||
|
||||
$finalAttributes = array_merge($defaultAttributes, $attributes);
|
||||
|
||||
return getElementHtml('option', $finalAttributes, $content);
|
||||
}
|
||||
|
||||
function getSelectHtml($name, $currentValue, $options, $attributes = array())
|
||||
{
|
||||
$defaultAttributes = array(
|
||||
'size' => 1,
|
||||
'id' => $name,
|
||||
'name' => $name
|
||||
);
|
||||
|
||||
$finalAttributes = array_merge($defaultAttributes, $attributes);
|
||||
$content = getOptionGroup($options, $currentValue);
|
||||
|
||||
return getElementHtml('select', $finalAttributes, $content);
|
||||
}
|
||||
|
||||
function getCheckboxHtml($name, $currentValue, $attributes = array())
|
||||
{
|
||||
$defaultAttributes = array(
|
||||
'type' => 'checkbox',
|
||||
'id' => $name,
|
||||
'name' => $name,
|
||||
'value' => isset($attributes['value']) ? $attributes['value'] : 'On'
|
||||
);
|
||||
|
||||
$finalAttributes = array_merge($defaultAttributes, $attributes);
|
||||
if ($currentValue == $finalAttributes['value']) { // Keep weak
|
||||
$finalAttributes['checked'] = 'checked';
|
||||
}
|
||||
|
||||
return getElementHtml('input', $finalAttributes, false);
|
||||
}
|
||||
|
||||
function getButton($value, $output = null)
|
||||
{
|
||||
$escaped = false;
|
||||
$finalValue = $value[0] === '&' ? $value : htmlentities($value);
|
||||
if ($output === null) {
|
||||
$output = $value;
|
||||
} else {
|
||||
$escaped = true;
|
||||
}
|
||||
|
||||
$code = '<input type="button" value="' . $finalValue . '" data-output="' . $output . '"' . ($escaped ? ' data-escaped="true"' : '') . ' />';
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fonts available for drawing.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
function listfonts($folder)
|
||||
{
|
||||
$array = array();
|
||||
if (($handle = opendir($folder)) !== false) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (substr($file, -4, 4) === '.ttf') {
|
||||
$array[$file] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
array_unshift($array, 'No Label');
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the barcodes present for drawing.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
function listbarcodes()
|
||||
{
|
||||
include_once('barcode.php');
|
||||
|
||||
$availableBarcodes = array();
|
||||
foreach ($supportedBarcodes as $file => $title) {
|
||||
if (file_exists($file)) {
|
||||
$availableBarcodes[$file] = $title;
|
||||
}
|
||||
}
|
||||
|
||||
return $availableBarcodes;
|
||||
}
|
||||
|
||||
function findValueFromKey($haystack, $needle)
|
||||
{
|
||||
foreach ($haystack as $key => $value) {
|
||||
if (strcasecmp($key, $needle) === 0) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function convertText($text)
|
||||
{
|
||||
$text = stripslashes($text);
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
$text = mb_convert_encoding($text, 'ISO-8859-1', 'UTF-8');
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
137
html/include/barcodegen_php8/example/html/include/header.php
Normal file
137
html/include/barcodegen_php8/example/html/include/header.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
if (!defined('IN_CB')) {
|
||||
die('You are not allowed to access to this page.');
|
||||
}
|
||||
|
||||
if (version_compare(phpversion(), '5.0.0', '>=') !== true) {
|
||||
exit('Sorry, but you have to run this script with PHP5... You currently have the version <b>' . phpversion() . '</b>.');
|
||||
}
|
||||
|
||||
if (!function_exists('imagecreate')) {
|
||||
exit('Sorry, make sure you have the GD extension installed before running this script.');
|
||||
}
|
||||
|
||||
include_once('function.php');
|
||||
|
||||
// FileName & Extension
|
||||
$system_temp_array = explode('/', $_SERVER['PHP_SELF']);
|
||||
$filename = $system_temp_array[count($system_temp_array) - 1];
|
||||
$system_temp_array2 = explode('.', $filename);
|
||||
$availableBarcodes = listBarcodes();
|
||||
$barcodeName = findValueFromKey($availableBarcodes, $filename);
|
||||
$code = $system_temp_array2[0];
|
||||
|
||||
// Check if the code is valid
|
||||
if (file_exists('config' . DIRECTORY_SEPARATOR . $code . '.php')) {
|
||||
include_once('config' . DIRECTORY_SEPARATOR . $code . '.php');
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $barcodeName; ?> - Barcode Bakery</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link type="text/css" rel="stylesheet" href="style.css" />
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<script src="jquery-1.7.2.min.js"></script>
|
||||
<script src="barcode.js"></script>
|
||||
</head>
|
||||
<body class="<?php echo $code; ?>">
|
||||
|
||||
<?php
|
||||
$default_value = array();
|
||||
$default_value['filetype'] = 'PNG';
|
||||
$default_value['dpi'] = 72;
|
||||
$default_value['scale'] = isset($defaultScale) ? $defaultScale : 1;
|
||||
$default_value['rotation'] = 0;
|
||||
$default_value['font_family'] = 'Arial.ttf';
|
||||
$default_value['font_size'] = 8;
|
||||
$default_value['text'] = '';
|
||||
$default_value['a1'] = '';
|
||||
$default_value['a2'] = '';
|
||||
$default_value['a3'] = '';
|
||||
|
||||
$filetype = isset($_POST['filetype']) ? $_POST['filetype'] : $default_value['filetype'];
|
||||
$dpi = isset($_POST['dpi']) ? $_POST['dpi'] : $default_value['dpi'];
|
||||
$scale = intval(isset($_POST['scale']) ? $_POST['scale'] : $default_value['scale']);
|
||||
$rotation = intval(isset($_POST['rotation']) ? $_POST['rotation'] : $default_value['rotation']);
|
||||
$font_family = isset($_POST['font_family']) ? $_POST['font_family'] : $default_value['font_family'];
|
||||
$font_size = intval(isset($_POST['font_size']) ? $_POST['font_size'] : $default_value['font_size']);
|
||||
$text = isset($_POST['text']) ? $_POST['text'] : $default_value['text'];
|
||||
|
||||
registerImageKey('filetype', $filetype);
|
||||
registerImageKey('dpi', $dpi);
|
||||
registerImageKey('scale', $scale);
|
||||
registerImageKey('rotation', $rotation);
|
||||
registerImageKey('font_family', $font_family);
|
||||
registerImageKey('font_size', $font_size);
|
||||
registerImageKey('text', stripslashes($text));
|
||||
|
||||
// Text in form is different than text sent to the image
|
||||
$text = convertText($text);
|
||||
?>
|
||||
|
||||
<div class="header">
|
||||
<header>
|
||||
<img class="logo" src="logo.png" alt="Barcode Bakery" />
|
||||
<nav>
|
||||
<label for="type">Symbology</label>
|
||||
<?php echo getSelectHtml('type', $filename, $availableBarcodes); ?>
|
||||
<a class="info explanation" href="#"><img src="info.gif" alt="Explanation" /></a>
|
||||
</nav>
|
||||
</header>
|
||||
<?php
|
||||
if (ini_get('mbstring.func_overload') != '0') {
|
||||
echo '<div class="warning">Warning! mbstring.func_overload is not set to 0. The generation of images might not work properly.</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
|
||||
<h1>Barcode Bakery</h1>
|
||||
<h2><?php echo $barcodeName; ?></h2>
|
||||
<div class="configurations">
|
||||
<section class="configurations">
|
||||
<h3>Configurations</h3>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col class="col1" />
|
||||
<col class="col2" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><label for="filetype">File type</label></td>
|
||||
<td><?php echo getSelectHtml('filetype', $filetype, array('PNG' => 'PNG - Portable Network Graphics', 'JPEG' => 'JPEG - Joint Photographic Experts Group', 'GIF' => 'GIF - Graphics Interchange Format')); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="dpi">DPI</label></td>
|
||||
<td><?php echo getInputTextHtml('dpi', $dpi, array('type' => 'number', 'min' => 72, 'max' => 300, 'required' => 'required')); ?> <span id="dpiUnavailable">DPI is available only for PNG and JPEG.</span></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (isset($baseClassFile) && file_exists('include' . DIRECTORY_SEPARATOR . $baseClassFile)) {
|
||||
include_once('include' . DIRECTORY_SEPARATOR . $baseClassFile);
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><label for="scale">Scale</label></td>
|
||||
<td><?php echo getInputTextHtml('scale', $scale, array('type' => 'number', 'min' => 1, 'required' => 'required')); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="rotation">Rotation</label></td>
|
||||
<td><?php echo getSelectHtml('rotation', $rotation, array(0 => 'No rotation', 90 => '90° clockwise', 180 => '180° clockwise', 270 => '270° clockwise')); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="font_family">Font</label></td>
|
||||
<td><?php echo getSelectHtml('font_family', $font_family, listfonts('../font')); ?> <?php echo getInputTextHtml('font_size', $font_size, array('type' => 'number', 'min' => 1, 'max' => 30)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="text">Data</label></td>
|
||||
<td>
|
||||
<div class="generate" style="float: left"><?php echo getInputTextHtml('text', $text, array('type' => 'text', 'required' => 'required')); ?> <input type="submit" value="Generate" /></div>
|
||||
<div class="possiblechars" style="float: right; position: relative;"><a href="#" class="info characters"><img src="info.gif" alt="Help" /></a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
2
html/include/barcodegen_php8/example/html/index_1D.php
Normal file
2
html/include/barcodegen_php8/example/html/index_1D.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
header('Location: BCGcode39.php');
|
||||
BIN
html/include/barcodegen_php8/example/html/info.gif
Normal file
BIN
html/include/barcodegen_php8/example/html/info.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 B |
9404
html/include/barcodegen_php8/example/html/jquery-1.7.2.js
vendored
Normal file
9404
html/include/barcodegen_php8/example/html/jquery-1.7.2.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
html/include/barcodegen_php8/example/html/jquery-1.7.2.min.js
vendored
Normal file
4
html/include/barcodegen_php8/example/html/jquery-1.7.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
html/include/barcodegen_php8/example/html/logo.png
Normal file
BIN
html/include/barcodegen_php8/example/html/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
211
html/include/barcodegen_php8/example/html/style.css
Normal file
211
html/include/barcodegen_php8/example/html/style.css
Normal file
@@ -0,0 +1,211 @@
|
||||
body {
|
||||
font-family: Segoe UI, Calibri, Arial, Helvetica;
|
||||
font-size: 12px;
|
||||
color: #111;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
form, .header {
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: 60%;
|
||||
min-width: 600px;
|
||||
max-width: 700px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
input, select {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
input[type=text], input[type=number], select {
|
||||
border: 1px solid #ababab;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
select {
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
section {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 14px 0 8px 0;
|
||||
font-weight: normal;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid #c8c8c8;
|
||||
margin: 0 0 14px 0;
|
||||
}
|
||||
|
||||
.logo {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
nav {
|
||||
float: right;
|
||||
position: absolute;
|
||||
top: 34px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
nav label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav select {
|
||||
margin: 2px 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding: 3px 25px 1px 4px;
|
||||
vertical-align: top;
|
||||
height: 26px; /* This act as a min-height */
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
table tr.odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
table tr.even {
|
||||
}
|
||||
|
||||
table .col1 {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
table .info {
|
||||
position: absolute;
|
||||
dtop: 0;
|
||||
dright: 5px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.info img {
|
||||
border: 0;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
.generate {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.possiblechars {
|
||||
float: right;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#dpiUnavailable {
|
||||
display: none;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
div.configurations select {
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
div.configurations input[type=number] {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
/* Moved section by script */
|
||||
#explanation, #dpiExplain, #validCharacters {
|
||||
display: none;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
#explanation ul {
|
||||
list-style: disc;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#specificOptions {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#validCharacters input[type=button] {
|
||||
width: 25px;
|
||||
padding: 1px 6px;
|
||||
}
|
||||
|
||||
.BCGcode128 #validCharacters input[type=button],
|
||||
.BCGcode39extended #validCharacters input[type=button],
|
||||
.BCGcode93 #validCharacters input[type=button],
|
||||
.BCGgs1128 #validCharacters input[type=button],
|
||||
.BCGaztec #validCharacters input[type=button],
|
||||
.BCGdatamatrix #validCharacters input[type=button],
|
||||
.BCGmaxicode #validCharacters input[type=button],
|
||||
.BCGqrcode #validCharacters input[type=button],
|
||||
.BCGpdf417 #validCharacters input[type=button] {
|
||||
width: 39px;
|
||||
}
|
||||
|
||||
.bubble {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bubble.visible {
|
||||
display: block !important;
|
||||
position: absolute;
|
||||
background-color: #f8f8f8;
|
||||
border: 2px solid #ddd;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.gs1128_id {
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gs1128_value {
|
||||
width: 295px;
|
||||
}
|
||||
|
||||
.gs1128_delete img {
|
||||
border: 0;
|
||||
margin-left: 5px;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
#identifierContainer {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background-color: #fcf8e3;
|
||||
border: 1px solid #faf2cc;
|
||||
color: #8a6d3b;
|
||||
padding: 8px;
|
||||
}
|
||||
2
html/include/barcodegen_php8/example/index.php
Normal file
2
html/include/barcodegen_php8/example/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
header('Location: html/index_1D.php');
|
||||
40
html/include/barcodegen_php8/example/vendor/autoload.php
vendored
Normal file
40
html/include/barcodegen_php8/example/vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// This autoload is here just in case you didn't run composer install.
|
||||
// Running composer install would be a better way to autoload the classes.
|
||||
|
||||
// We search in the ../../packages/ folder
|
||||
$packageFolder = __DIR__ . '/../../packages';
|
||||
spl_autoload_register(function ($className) use ($packageFolder) {
|
||||
$tryFolders = array();
|
||||
$splits = explode('\\', $className);
|
||||
|
||||
$c = count($splits);
|
||||
if ($c > 0 && $splits[0] === 'BarcodeBakery') {
|
||||
if ($c > 1) {
|
||||
if ($splits[1] === 'Common') {
|
||||
$tryFolders = array('barcode-common', 'gs1ai');
|
||||
} else {
|
||||
// Try all the other folders
|
||||
$tryFolders = array_filter(scandir($packageFolder), function ($f) {
|
||||
if ($f !== '.' && $f !== '..' && $f !== 'barcode-common' && $f !== 'gs1ai') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($tryFolders) > 0) {
|
||||
$file = implode('/', array_slice($splits, 2)) . '.php';
|
||||
foreach ($tryFolders as $folder) {
|
||||
$fullpath = $packageFolder . '/' . $folder . '/src/' . $file;
|
||||
|
||||
if (file_exists($fullpath)) {
|
||||
include $fullpath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user