我使用PHP類條碼編碼器(http://barcode-coder.com)生成code128條碼作爲GIF。它工作正常,掃描儀可以讀取它。但是,我想要打印條形碼的區域對於圖像來說很小,如果我只是按比例縮小圖像,則掃描失敗(邏輯上)。有沒有一種方法來設置條的寬度,目前看起來像是使用了兩個像素,這使得它在打印區域變寬。 在示例/ docs中有一個在線生成器,用於生成更細的條形碼的barcorde,但我無法找到此設置。如何設置尺碼爲條碼編碼器code128
我目前使用
$code = isset($_GET["message"]) ? $_GET["message"] : "";
// Settings for barcode
$marge = 0; // between barcode and hri in pixel
$x = 100; // barcode center
$y = 15; // barcode center
$height = 30; // barcode height in 1D ; module size in 2D
$width = 2; // barcode height in 1D ; not use in 2D
$angle = 0; // rotation in degrees : nb : non horizontable barcode might not be usable because of pixelisation
$type = 'code128';
// ALLOCATE GD RESSOURCE
$im = imagecreatetruecolor(200, 30);
$black = ImageColorAllocate($im,0x00,0x00,0x00);
$white = ImageColorAllocate($im,0xff,0xff,0xff);
imagefilledrectangle($im, 0, 0, 200, 30, $white);
// Create barcode
$data = Barcode::gd($im, $black, $x, $y, $angle, $type, array('code'=>$code), $width, $height);
// Generate image with barcode
header('Content-type: image/gif');
imagegif($im);
imagedestroy($im);
沒有,遺憾的是它並不像從2到1只設置$寬度一樣簡單的代碼,僅僅是吧,不是吧itselfs之間的間距, 我認爲。
任何幫助,非常感謝。