/** * Constructor * * @param string $text * @param int $modulesize */ public function __construct($text, $moduleSize = 2, $allowedChars = null) { try { parent::__construct($text, $moduleSize); if ($allowedChars) { $this->checkAllowedChars($text, $allowedChars); } } catch (Exception $e) { throw $e; } }
/** * Constructor * * @param string $text * @param int $moduleSize * @param char $ecl */ public function __construct($text, $moduleSize = parent::MODULE_SIZE, $ecl = self::ECL_L_CODE, $version = null) { try { parent::__construct($text, $moduleSize); // Convert input text to UTF-8 $current_encoding = mb_detect_encoding($this->text, 'auto'); $this->text = iconv($current_encoding, 'UTF-8', $this->text); $this->ecl = $this->eclConvertTable[$ecl]; // Num of input chars $this->charsNum = strlen($text); $this->mode = $this->getMode($text); // Mask reference $this->maskReference = rand(0, 7); // Version $this->version = $this->getVersion($this->charsNum, $this->ecl, $this->mode, $version); // Code size $this->matrixSize = $this->getMatrixSize($this->version); $this->symbolSize = $this->matrixSize + 2 * self::QUIET_ZONE; $this->countGaloisField(); // Init matrixes $this->init(); $this->bitsCoordinates = $this->getBitsCoordinates($this->maskedMatrix); $this->convertData(); // Format info $formatInformation = $this->formatInformation($this->ecl, $this->maskReference); $this->matrix = $this->addFormatInformation($this->matrix, $formatInformation); // Version info if ($this->version >= 7 && $this->version <= 40) { $versionInformation = $this->versionInformation($this->version); $this->matrix = $this->addVersionInformation($this->matrix, $versionInformation); } } catch (Exception $e) { throw $e; } }
<?php include "./php-barcode/barcode.php"; if (!$_POST["discount"] == null) { $barCode = new barcode(null, null, null); $barCode->_show(); } ?> <html> <header> <meta name="viewport" content="width=device-width, initial-scale=1" property=""/> </header> <body> <form action="" method="post"> <div> <label for="discount">Discount : </label> <select name="discount" class="weight190" id="discount" > <option value="54">4c</option> <OPTION VALUE="56">6c</OPTION> <OPTION VALUE="60">10c</OPTION> <OPTION VALUE="70">20c</OPTION> <OPTION VALUE="85">35c</OPTION> <OPTION VALUE="90">40c</OPTION> </select> <input type="submit" value="Generate" /> </div> </form> </body> </html>
http://vamshop.ru http://vamshop.com Copyright (c) 2007 VaM Shop ----------------------------------------------------------------------------------------- based on: (c) 2000-2001 The Exchange Project (earlier name of osCommerce) (c) 2002-2003 osCommerce(product_info.php,v 1.94 2003/05/04); www.oscommerce.com (c) 2003 nextcommerce (product_info.php,v 1.46 2003/08/25); www.nextcommerce.org (c) 2004 xt:Commerce (product_info.php,v 1.46 2003/08/25); xt-commerce.com Released under the GNU General Public License ---------------------------------------------------------------------------------------*/ define('BARCODE_HEIGHT', '50'); define('BARCODE_SCALE', '1.25'); if (isset($_GET['products_id']) && (int) $_GET['products_id'] > 0) { include 'includes/application_top.php'; $ean_query = vam_db_query("SELECT products_ean FROM " . TABLE_PRODUCTS . " WHERE products_id='" . (int) $_GET['products_id'] . "'"); if (($eanData = vam_db_fetch_array($ean_query)) && $eanData['products_ean'] != '') { require_once DIR_WS_CLASSES . 'barcode.inc.php'; $barcode = new barcode(); $barcode->setHeight(BARCODE_HEIGHT); $barcode->setScale(BARCODE_SCALE); $barcode->setFont(DIR_WS_INCLUDES . 'fonts/arialbd.ttf'); $barcode->setFormat('gif'); if ($barcode->genBarCode($eanData['products_ean']) == false) { $barcode->error(true); } } include 'includes/application_bottom.php'; }
<?php /* Test unit for barcode.class */ include "barcode.class.php"; $mybarcode = new barcode(); $text = "*X000100001245*"; $size = array(240, 24); $angle = 0; $fontsize = 32; $text_color = array(0, 0, 0); $fill_color = array(255, 255, 255); $mybarcode->image_create($text, $size); //$mybarcode->save_file(); $mybarcode->show(); //See barcode.test.html
<?php include "barcode.class.php"; if (isset($_GET["code"])) { $c = new barcode(strtoupper($_GET["code"]), 200, 80); $c->showCodeImage(); //echo strtoupper($_GET["code"]); } //echo strtoupper($_GET["code"]); //echo "<pre>"; //var_dump($c->showCodeImage()); //echo "</pre>"; //$c="TEST8052"; /*$c=array("T","E","S","1");$k=array_search("S",$c); echo $k;*/