static function generate_barcode($string='EXAMPLE', $convert='png', $enctype='code128b') {
$string = escapeshellarg($string);
$enctype = escapeshellarg($enctype);
- $convert = $convert ? " | convert - -crop 0x60+0+30\\! -background white -flatten $convert:-" : '';
+ $convert = $convert ? " | convert - -crop 0x60+0+30\\! -background none -flatten $convert:-" : '';
return shell_exec("barcode -e $enctype -E -b $string$convert");
}
header('Content-Type: image/png');
header('Cache-Control: max-age=604800, public'); //1week caching
} else die();
+ error_reporting(0); //TODO: enable errors again
die(self::cached_barcode($string,$convert,$enctype));
}
}