56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
if (!class_exists(Picqer\Barcode\BarcodeGeneratorPNG::class)) {
|
|
// HACK superhack, ale jinak to nejde, je to kvuli kompatibilite, nekteri to volaji
|
|
// naprimo z /engine aby to bylo bez loginu pres admin
|
|
chdir(str_replace('engine/admin/barcode.php', '', $_SERVER['SCRIPT_FILENAME']));
|
|
|
|
if (file_exists('./config/config.php')) {
|
|
require_once './config/config.php';
|
|
} else {
|
|
require_once './include/config.php';
|
|
}
|
|
|
|
require_once './include/functions.php';
|
|
require_once './engine/web/common.php';
|
|
}
|
|
|
|
$type = 'int25';
|
|
if (!empty($_GET['type'])) {
|
|
$type = $_GET['type'];
|
|
}
|
|
|
|
if ($type == 'ean13') {
|
|
$_GET['oID'] = sprintf('%013d', intval($_GET['oID']));
|
|
}
|
|
|
|
$height = 60;
|
|
if (!empty($_GET['height'])) {
|
|
$height = $_GET['height'];
|
|
}
|
|
$size = $_GET['size'] ?? 1;
|
|
$show_value = ($_GET['showValue'] ?? '') !== 'false';
|
|
|
|
// Convert to BarcodeGenerator
|
|
$generator = new Picqer\Barcode\BarcodeGeneratorPNG();
|
|
|
|
switch ($type) {
|
|
case 'int25':
|
|
$type = $generator::TYPE_INTERLEAVED_2_5;
|
|
break;
|
|
case 'ean13':
|
|
$type = $generator::TYPE_EAN_13;
|
|
break;
|
|
case 'code39':
|
|
$type = $generator::TYPE_CODE_39;
|
|
break;
|
|
case 'code128':
|
|
$type = $generator::TYPE_CODE_128;
|
|
break;
|
|
}
|
|
|
|
$result = $generator->getBarcode($_GET['oID'], $type, $size + 1, $height);
|
|
|
|
header('Content-Type: image/png');
|
|
echo $result;
|