Сгенерированный штрих-код не читается

Я использую следующий код для создания штрих-кода EAN13. Штрих-код создается без каких-либо проблем, но при сканировании он не распознается.

В чем проблема?

include('php-barcode.php');

$font     = 'fonts/GSMT.TTF';

$fontSize = 16;   // GD1 in px ; GD2 in point
$marge    = 10;   // between barcode and hri in pixel
$x        = 80;  // barcode center
$y        = 80;  // barcode center
$height   = 50;   // barcode height in 1D ; module size in 2
$width    = 2;    // barcode height in 1D ; not use in 2D
$angle    = 0;

$code     = "111110001001"; // barcode, of course ;)
$type     = "ean13"; //

$im     = imagecreatetruecolor(180, 180);
$black  = ImageColorAllocate($im,0x00,0x00,0x00);
$white  = ImageColorAllocate($im,0xff,0xff,0xff);
imagefilledrectangle($im, 0, 0, 180, 180, $white);

$data = Barcode::gd($im, $black, $x, $y, $angle, $type, array('code'=>$code), $width, $height);

if ( isset($font) ){
$box = imagettfbbox($fontSize, 0, $font, $data['hri']);
$len = $box[2] - $box[0];
Barcode::rotate(-$len / 2, ($data['height'] / 2) + $fontSize + $marge, $angle, $xt, $yt);
imagettftext($im, $fontSize, $angle, $x + $xt, $y + $yt, $black, $font, $data['hri']);
}

header('Content-type: image/png');
imagepng($im);
imagedestroy($im);

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …