<?PHP//including all required classesrequire_once(' class/bcgfontfile.php ');//Introducing font Generation filesrequire_once(' class/bcgcolor.php ');//Introducing background color filesrequire_once(' class/bcgdrawing.php ');//Introducing picture generation files//Including the barcode technologyrequire_once(' class/bcgcode39.barcode.php ');//Barcode Encoding Rule file introduced//Loading Font$font=NewBcgfontfile ('./font/arial.ttf ', 18);//introduce fonts and set the font size//Don ' t forget to sanitize user inputs$text=isset($_get[' Text ']) ?$_get[' Text ']: ' DSFDFASDA ';//sets the contents of the original text of the barcode//The arguments is R, G, B for color.$color _black=NewBcgcolor (0, 0, 0);//set the RGB color for black$color _white=NewBcgcolor (255, 255, 255);//set the RGB color for white$drawException=NULL;Try { $code=NewBCGcode39 ();//to create a new object $code->setscale (1.4);//Resolution//Set scale of scaling $code->setthickness (60);//Thickness//Set height $code->setforegroundcolor ($color _black);//Color of Bars $code->setbackgroundcolor ($color _white);//Color of Spaces $code->setfont ($font);//Font (or 0)//Set fonts $code->parse ($text);//text//Convert font}Catch(Exception $exception) { $drawException=$exception;}/*Here is the list of the arguments1-filename (empty:display in screen) 2-background color*/$drawing=NewBcgdrawing ("',$color _white);//Create a piece of canvasif($drawException) { $drawing->drawexception ($drawException);//If the error is caught, the output}Else { $drawing->setbarcode ($code);//Setting up Barcodes $drawing->draw ();//Create a picture}//Header that says it's an image (remove it if you save the barcode to a file)Header(' Content-type:image/png ');//tell the browser this is a PNG-formatted pictureHeader(' Content-disposition:inline; filename= "Barcode.png");//configuration, in-line, set file name//Draw (or save) the image into PNG format.$drawing->finish (bcgdrawing::img_format_png);//output image is in PNG format?>
PHP Generated Barcode Source Interpretation