Beispiel #1
0
 public function genera($codice)
 {
     $this->nome = "Codice{$codice}.png";
     $this->mime = 'image/png';
     $i = Image_Barcode2::draw($codice, $this->tipo, Image_Barcode2::IMAGE_PNG, false, $this->altezza, $this->larghezza, $this->testo);
     return imagejpeg($i, $this->percorso());
 }
Beispiel #2
0
 public function getImage($data)
 {
     $ret = null;
     try {
         ob_start();
         $ret = Image_Barcode2::draw($data, $this->opt_type, $this->opt_format, false, $this->opt_height, $this->opt_width, $this->opt_showText, $this->opt_rotation);
         ob_end_clean();
     } catch (Exception $e) {
     }
     return $ret;
 }
 public function __createBarcord($id = null, $fileName)
 {
     // draw引数
     // 1.バーコードデータ
     // 2.バーコードタイプ ( code39, int25, ean13, code128, postnet, ean8, upca, upce )
     // 3.画像形式 ( gif, jpg, png )
     // 4.画像出力 ( true, false )
     // 5.高さ ( デフォルト 60 )
     // 6.幅 ( デフォルト 1, 全体の幅ではないので注意 )
     // 7.バーコードの値を表示するか ( true, false )
     // 8.回転
     $code = new Image_Barcode2();
     $image = $code->draw('000537', 'code128', 'png', false);
     // $this->set('test', base64_encode($image));
     imagepng($image, FILE_BARCORD . $fileName);
 }
 /**
  * @param $barcode string
  * @param $type string
  * @param $fileExt string
  * @param $height int
  * @param $width int
  *
  * @return resource
  */
 public function getResource($barcode, $type, $fileExt, $height, $width)
 {
     return ImageBarcode::draw($barcode, $type, $fileExt, false, $height, $width);
 }
<?php

require_once 'Barcode2.php';
$num = isset($_REQUEST['s']) ? $_REQUEST['s'] : '0';
Image_Barcode2::draw($num, 'code128', 'png', true, 30, 2);
Beispiel #6
0
    # P7: height
    # P8: Print human readable (B=yes, N=no)
    # DATA: barcode data
    fwrite($f, "B100,20,0,1,2,4,140,B,\"{$barcode}\"\r\n");
    fwrite($f, "P1\r\n");
    # Print
    fclose($f);
}
if (array_key_exists('render', $_GET)) {
    $barcode = $_GET['render'];
    if (!is_barcode_valid($barcode)) {
        header('Content-Type: text/plain; charset=UTF-8');
        print "Invalid barcode";
    } else {
        header('Content-Type: image/png');
        Image_Barcode2::draw($barcode, 'code128', 'png', true, 20);
    }
} elseif (array_key_exists('print', $_GET)) {
    $barcode = $_GET['print'];
    header('Content-Type: text/plain; charset=UTF-8');
    if (!is_barcode_valid($barcode)) {
        print "Invalid barcode";
    } else {
        print_epl2($barcode);
    }
} elseif (array_key_exists('userid', $_GET)) {
    header('Content-Type: text/html; charset=UTF-8');
    $userid = $_GET['userid'];
    print <<<END_HEAD
<html>
 <head>
<?php

error_reporting(0);
include_once '../../config/symbini.php';
@(include_once "Image/Barcode.php");
@(include_once "Image/Barcode2.php");
header("Content-type: image/png");
$bcText = array_key_exists('bctext', $_REQUEST) ? $_REQUEST["bctext"] : '';
$bcCode = array_key_exists('bccode', $_REQUEST) ? $_REQUEST['bccode'] : 'Code39';
$imgType = array_key_exists('imgtype', $_REQUEST) ? $_REQUEST['imgtype'] : 'png';
$bcHeight = array_key_exists('bcheight', $_REQUEST) ? $_REQUEST['bcheight'] : 50;
if ($bcText) {
    if (class_exists('Image_Barcode2')) {
        $bcText = strtoupper($bcText);
        $bcObj = new Image_Barcode2();
        $bc = $bcObj->draw($bcText, "Code39", "png", false, $bcHeight);
        imagepng($bc);
        imagedestroy($bc);
    } elseif (class_exists('Image_Barcode')) {
        $bcText = strtoupper($bcText);
        $bcObj = new Image_Barcode();
        $bc = $bcObj->draw($bcText, "Code39", "png");
        imagepng($bc);
        imagedestroy($bc);
    }
}
Beispiel #8
0
<?php

require_once "../../Image/Barcode2.php";
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '15101967^Iarewr';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'code128';
$imgtype = isset($_REQUEST['imgtype']) ? $_REQUEST['imgtype'] : 'png';
Image_Barcode2::draw($num, $type, $imgtype);
Beispiel #9
0
 function ibarras($id = 0, $alto = 20)
 {
     //error_reporting(0);
     $id = intval($id);
     if ($id <= 0) {
         return '';
     }
     require_once 'Image/Barcode2.php';
     $codigo = $this->datasis->dameval("SELECT codigo FROM sinv WHERE id={$id}");
     Image_Barcode2::draw($codigo, 'code128', 'png', true, $alto);
 }
<?php

require __DIR__ . '/../../vendor/autoload.php';
$img = \Image_Barcode2::draw('4003994155486', \Image_Barcode2::BARCODE_EAN13, \Image_Barcode2::IMAGE_PNG, false);
imagepng($img, '/test.png');