Skip to content

Instantly share code, notes, and snippets.

@evilnapsis
Created February 26, 2018 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilnapsis/c741349c809f726f975d0bad5728c67e to your computer and use it in GitHub Desktop.
Save evilnapsis/c741349c809f726f975d0bad5728c67e to your computer and use it in GitHub Desktop.
generar codigo de barras con PHP
<?php
require_once('class/BCGFontFile.php');
require_once('class/BCGColor.php');
require_once('class/BCGDrawing.php');
require_once('class/BCGcode128.barcode.php');
header('Content-Type: image/png');
$colorFront = new BCGColor(0, 0, 0);
$colorBack = new BCGColor(255, 255, 255);
$code = new BCGcode128();
$code->setScale(4);
$code->setThickness(30);
$code->setForegroundColor($colorFront);
$code->setBackgroundColor($colorBack);
$code->parse('http://evilnapsis.com/');
$drawing = new BCGDrawing('', $colorBack);
$drawing->setBarcode($code);
$drawing->draw();
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment