private function _generateBarCodes($nos) { $barcodes = array(); for ($i = 1; $i <= $nos; $i++) { $text = generateCode(10, 2); $dest = "assets/barcodes/" . $text . ".jpg"; Barcode39($text, $text, $dest, 220, 120); $barcodes[$i] = $text; } return $barcodes; }
if (empty($width)) { $width = 160; } if (empty($height)) { $height = 80; } if (!empty($format)) { $format = strtoupper($format); } else { $format = "PNG"; } switch ($type) { default: $type = 1; case 1: Barcode39($barcode, $width, $height, $quality, $format, $text); break; } //----------------------------------------------------------------------------- // Generate a Code 3 of 9 barcode //----------------------------------------------------------------------------- function Barcode39($barcode, $width, $height, $quality, $format, $text) { switch ($format) { default: $format = "JPEG"; case "JPEG": header("Content-type: image/jpeg"); break; case "PNG": header("Content-type: image/png");
//----------------------------------------------------------------------------- // Startup code //----------------------------------------------------------------------------- ini_set("display_errors", "On"); if (!isset($text)) { $text = "1"; } $quality = $_GET["quality"] ? $_GET["quality"] : 100; $width = $_GET["width"] ? $_GET["width"] : 160 * 4; $height = $_GET["height"] ? $_GET["height"] : 80; //$format = 'GIF'; switch ($type) { default: $type = 1; case 1: Barcode39($_GET["barcode"], $width, $height, $quality, $format, $text); break; } //----------------------------------------------------------------------------- // Generate a Code 3 of 9 barcode //----------------------------------------------------------------------------- function Barcode39($barcode, $width, $height, $quality, $format, $text) { switch ($format) { default: $format = "JPEG"; case "JPEG": header("Content-type: image/jpeg"); break; case "PNG": header("Content-type: image/png");