MINI
C:
/
SiakApp
/
lib
/
Upload File:
files >> C:/SiakApp/lib/barcode.php
<?php function barcode($isi){ $file_dir_prop=getcwd().'/barcode/'.substr($isi,0,2); $file_path=$file_dir_prop.'/'.substr($isi,0,6); $file_barcode=$file_path.'/'.$isi.'.png'; if(!is_dir($file_dir_prop)){ mkdir($file_dir_prop); } if(!is_dir($file_path)){ mkdir($file_path); } if(!file_exists($file_barcode)){ // Including all required classes //require('class/BCGFont.php'); require_once('class/BCGColor.php'); require_once('class/BCGDrawing.php'); // Including the barcode technology include_once('class/BCGcode39.barcode.php'); // 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(1); // 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($isi); // Text $code->setLabel(''); /* Here is the list of the arguments 1 - Filename (empty : display on screen) 2 - Background color */ $drawing = new BCGDrawing($file_barcode, $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(BCGDrawing::IMG_FORMAT_PNG); } return $file_barcode; //return 'nama filenya'; } ?>
Copyright ©2021 || Defacer Indonesia