setscale(2);
$code->setthickness(30); // 条形码的厚度
$code->setforegroundcolor($color_black); // 条形码颜色
$code->setbackgroundcolor($color_white); // 空白间隙颜色
$code->setfont($font); //
$code->parse('hello'); // 条形码需要的数据内容
} catch(exception $exception) {
$drawexception = $exception;
}
//根据以上条件绘制条形码
$drawing = new bcgdrawing('', $color_white);
if($drawexception) {
$drawing->drawexception($drawexception);
} else {
$drawing->setbarcode($code);
$drawing->draw();
}
// 生成png格式的图片
header('content-type: image/png');
$drawing->finish(bcgdrawing::img_format_png);
?>