Я попытался сгенерировать много штрих-кодов с помощью генератора штрих-кода. Есть много кодов, которые я вставил в text.txt. Но это сбой после запуска ниже кодов. Есть ли ошибки? Пожалуйста помоги.
Вот текст.txt
ABC0000001
ABC0000002
ABC0000003
Вот мой код:
<?php
require_once('class/BCGFontFile.php');
require_once('class/BCGColor.php');
require_once('class/BCGDrawing.php');
require_once('class/BCGcode128.barcode.php');
//I run the barcode text one by one here
foreach(file('text.txt') as $line) {
$font = new BCGFontFile('./font/Arial.ttf', 18);
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);
$text = $line;
$code = new BCGcode128();
$code->setScale(1);
$code->setThickness(30);
$code->setForegroundColor($color_black);
$code->setBackgroundColor($color_white);
$code->setFont($font);
$code->parse("'".$text."'"); // Text
$drawing = new BCGDrawing('images/filename'.$text.'.jpg', $color_white);
$drawing->setBarcode($code);
$drawing->draw();
$drawing->finish(BCGDrawing::IMG_FORMAT_JPEG);
}
?>
Ниже раздел ошибки
$c = count($posArray);
for ($i = 0; $i < $c; $i++) {
if (($curLen[$posArray[$i]] + $charSiz[$posArray[$i]]) < $nxtLen[$posArray[$i]]) {
$nxtLen[$posArray[$i]] = $curLen[$posArray[$i]] + $charSiz[$posArray[$i]];
$nxtSeq[$posArray[$i]] = $curSeq[$posArray[$i]] . '.';
}
for ($j = 0; $j < 2; $j++) {
if ($j === $posArray[$i]) { continue; }
if (($curLen[$j] + $shftLen[$j][$posArray[$i]] + $charSiz[$posArray[$i]]) < $nxtLen[$j]) {
$nxtLen[$j] = $curLen[$j] + $shftLen[$j][$posArray[$i]] + $charSiz[$posArray[$i]];
$nxtSeq[$j] = $curSeq[$j] . chr($posArray[$i] + 65) . '.';
}
}
}
if ($c === 0) {
// We found an unsuported character
throw new BCGParseException('code128', 'Character ' . $input . ' not supported.');
}
Задача ещё не решена.
Других решений пока нет …