1. Import
This commit is contained in:
43
html/include/barcode_php8/gen_barcode.php
Normal file
43
html/include/barcode_php8/gen_barcode.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// Including all required classes
|
||||
require('class/BCGFont.php');
|
||||
require('class/BCGColor.php');
|
||||
require('class/BCGDrawing.php');
|
||||
|
||||
// Including the barcode technology
|
||||
include('class/BCGcode39.barcode.php');
|
||||
|
||||
include_once ("../../include/mcglobal.inc.php");
|
||||
|
||||
// Check HTTP-Parameters
|
||||
getSecHttpVars("1",array("text"));
|
||||
|
||||
// Loading Font
|
||||
$font = new BCGFont('./class/font/Arial.ttf', 18);
|
||||
|
||||
// The arguments are R, G, B for color.
|
||||
$color_black = new BCGColor(0, 0, 0);
|
||||
$color_white = new BCGColor(255, 255, 255);
|
||||
|
||||
$code = new BCGcode39();
|
||||
$code->setScale(2); // Resolution
|
||||
$code->setThickness(30); // Thickness
|
||||
$code->setForegroundColor($color_black); // Color of bars
|
||||
$code->setBackgroundColor($color_white); // Color of spaces
|
||||
$code->setFont($font); // Font (or 0)
|
||||
$code->parse($text); // Text
|
||||
|
||||
|
||||
/* Here is the list of the arguments
|
||||
1 - Filename (empty : display on screen)
|
||||
2 - Background color */
|
||||
$drawing = new BCGDrawing('', $color_white);
|
||||
$drawing->setBarcode($code);
|
||||
$drawing->draw();
|
||||
|
||||
// Header that says it is an image (remove it if you save the barcode to a file)
|
||||
header('Content-Type: image/png');
|
||||
|
||||
// Draw (or save) the image into PNG format.
|
||||
$drawing->finish($drawing->IMG_FORMAT_PNG);
|
||||
?>
|
||||
Reference in New Issue
Block a user