First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
// Define variable to prevent hacking
|
||||
define('IN_CB',true);
|
||||
|
||||
// Including all required classes
|
||||
require('include/barcode/index.php');
|
||||
require('include/barcode/FColor.php');
|
||||
require('include/barcode/BarCode.php');
|
||||
require('include/barcode/FDrawing.php');
|
||||
|
||||
// including the barcode technology
|
||||
include('include/barcode/code39.barcode.php');
|
||||
|
||||
// Creating some Color (arguments are R, G, B)
|
||||
$color_black = new FColor(0,0,0);
|
||||
$color_white = new FColor(255,255,255);
|
||||
|
||||
/* Here is the list of the arguments:
|
||||
1 - Thickness
|
||||
2 - Color of bars
|
||||
3 - Color of spaces
|
||||
4 - Resolution
|
||||
5 - Text
|
||||
6 - Text Font (0-5) */
|
||||
$Text = "123456";
|
||||
if (array_key_exists('code',$_GET) && strlen($_GET['code'])) $Text = $_GET['code'];
|
||||
$code_generated = new code39(15,$color_black,$color_white,1,$Text,3);
|
||||
|
||||
/* Here is the list of the arguments
|
||||
1 - Width
|
||||
2 - Height
|
||||
3 - Filename (empty : display on screen)
|
||||
4 - Background color */
|
||||
$drawing = new FDrawing(1024,1024,'',$color_white);
|
||||
$drawing->init(); // You must call this method to initialize the image
|
||||
$drawing->add_barcode($code_generated);
|
||||
$drawing->draw_all();
|
||||
$im = $drawing->get_im();
|
||||
|
||||
// Next line create the little picture, the barcode is being copied inside
|
||||
$im2 = imagecreate($code_generated->lastX,$code_generated->lastY);
|
||||
imagecopyresized($im2, $im, 0, 0, 0, 0, $code_generated->lastX, $code_generated->lastY, $code_generated->lastX, $code_generated->lastY);
|
||||
$drawing->set_im($im2);
|
||||
|
||||
// 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(IMG_FORMAT_PNG);
|
||||
?>
|
||||
Reference in new issue
Block a user