示例#1
7
文件: Sma.php 项目: NimzyMaina/sma
 public function save_barcode($text = NULL, $bcs = 'code39', $height = 56, $stext = 1, $width = 256)
 {
     $drawText = $stext != 1 ? FALSE : TRUE;
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     $barcodeOptions = array('text' => $text, 'barHeight' => $height, 'drawText' => $drawText);
     $rendererOptions = array('imageType' => 'png', 'horizontalPosition' => 'center', 'verticalPosition' => 'middle');
     //'width' => $width
     $image = Zend_Barcode::draw($bcs, 'image', $barcodeOptions, $rendererOptions);
     //header ('Content-type: image/png');
     if (imagepng($image, 'assets/uploads/barcode' . $this->session->userdata('user_id') . '.png')) {
         imagedestroy($image);
         $bc = file_get_contents('assets/uploads/barcode' . $this->session->userdata('user_id') . '.png');
         $bcimage = base64_encode($bc);
         return $bcimage;
     }
     return FALSE;
 }
示例#2
5
 private function set_barcode($code)
 {
     $this->load->library('Zend');
     $this->zend->load('Zend/Barcode');
     //generate barcode
     Zend_Barcode::render('code128', 'image', array('text' => $code), array());
 }
示例#3
0
 public function zend()
 {
     $this->load->library('library_zend');
     $test = Zend_Barcode::draw('ean8', 'image', array('text' => 'abc123'), array());
     //var_dump($test);
     imagejpeg($test, 'temp/' . uniqid() . '.jpg', 100);
 }
示例#4
0
 public function getBarcodeImgSource()
 {
     $type = "code128";
     $orderId = $this->getOrder()->getIncrementId();
     $barcodeOptions = array('text' => $orderId, 'fontSize' => "14", 'withQuietZones' => true);
     $rendererOptions = array();
     $imageResource = Zend_Barcode::factory($type, 'image', $barcodeOptions, $rendererOptions);
     return $imageResource;
 }
示例#5
0
 function set_barcode($code)
 {
     //load library
     $this->load->library("zend");
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     Zend_Barcode::render('code128', 'image', array('text' => $code), array());
 }
示例#6
0
 private function set_bar($text)
 {
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     /*$barcodeOptions = array('text' => $text);
     		$rendererOptions = array();
     		Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions)->render();*/
     Zend_Barcode::render('code128', 'image', array('text' => $text), array());
 }
示例#7
0
文件: card.php 项目: jishnuvyala/lis
 public function barcode()
 {
     $code = $this->uri->segment(3, 0);
     //load library
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     $barcode = Zend_Barcode::render('code128', 'image', array('text' => $code), array());
 }
示例#8
0
文件: test.php 项目: jishnuvyala/lis
 private function barcode()
 {
     $code = $this->uri->segment(3, 0);
     //load library
     $this->load->library('zend');
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     Zend_Barcode::render('code39', 'image', array('text' => $code), array());
 }
示例#9
0
 public function generateBarcodeAction()
 {
     $product_code = $this->getRequest()->getParam('product_code');
     header('Content-type: image/png');
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $barcodeOptions = array('text' => "{$product_code}", 'barHeight' => 40);
     $rendererOptions = array();
     $renderer = Zend_Barcode::factory('code128', 'image', $barcodeOptions, $rendererOptions)->render();
 }
 /**
  * This can be used to generate barcodes, use the action
  *
  * /openrosa/barcode/code/<tokenid>
  *
  * example:
  * /openrosa/barocde/code/22pq-grkq
  *
  * The image will be a png
  */
 public function barcodeAction()
 {
     $code = $this->getRequest()->getParam('code', 'empty');
     \Zend_Layout::getMvcInstance()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $barcodeOptions = array('text' => $code);
     $rendererOptions = array();
     $barcode = \Zend_Barcode::render('code128', 'image', $barcodeOptions, $rendererOptions);
     $barcode->render();
 }
示例#11
0
 function barcode_generate($kode)
 {
     $houseno = $this->post('houseno');
     //$height =25;//tinggi barcode
     //$width = 3; //ketebalan barcode
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     $barcodeOPT = array('text' => $kode, 'barHeight' => $height, 'factor' => $width);
     $renderOPT = array();
     $render = Zend_Barcode::factory('code128', 'image', $barcodeOPT, $renderOPT)->render();
 }
 function barcode($code)
 {
     // We load her library's reading Zend.php file that contains the loader
     // For existing files in the folder Zend
     $this->load->library('zend');
     // Load that is in a folder Zend
     $this->zend->load('Zend/Barcode');
     // Generate barcodenya
     // $ Code = 12345abc;
     Zend_Barcode::render('code128', 'image', array('text' => $code), array());
 }
示例#13
0
文件: Util.php 项目: Nirun/HAsong01ha
 public function genBarcode($txt = '', $devMode = false)
 {
     $txt = $devMode ? 'Test Generate Barcode' : $txt;
     $this->CI->load->library('zend');
     $this->CI->zend->load('Zend/Barcode');
     $barcodeOption = array('text' => $txt, 'barHeight' => 30, 'font' => 2);
     $renderOption = array('');
     $render = Zend_Barcode::render('code128', 'image', $barcodeOption, $renderOption);
     return $render;
     //exit;
 }
示例#14
0
文件: PdfTest.php 项目: jsnshrmn/Suma
 public function testDrawWithExistantResourceReturnResource()
 {
     Zend_Barcode::setBarcodeFont(dirname(__FILE__) . '/../Object/_fonts/Vera.ttf');
     $barcode = new Zend_Barcode_Object_Code39(array('text' => '0123456789'));
     $this->_renderer->setBarcode($barcode);
     $pdfResource = new Zend_Pdf();
     $this->_renderer->setResource($pdfResource);
     $resource = $this->_renderer->draw();
     $this->assertTrue($resource instanceof Zend_Pdf);
     $this->assertSame($resource, $pdfResource);
     Zend_Barcode::setBarcodeFont('');
 }
示例#15
0
文件: Main.php 项目: projukti/dumkal
 private function set_barcode($code)
 {
     //load library
     $this->load->library('zend');
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     //Zend_Barcode::render('code128', 'image', array('text'=>$code), array());
     $barcodeOptions = array('text' => $code, 'barHeight' => 20, 'factor' => 1);
     $rendererOptions = array();
     $renderer = Zend_Barcode::factory('code128', 'image', $barcodeOptions, $rendererOptions)->render();
 }
示例#16
0
 function gambar($kode)
 {
     $height = 60;
     //tinggi barcode
     $width = 2;
     //ketebalan barcode
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     $barcodeOPT = array('text' => $kode, 'barHeight' => $height, 'factor' => $width);
     $renderOPT = array();
     $render = Zend_Barcode::factory('code128', 'image', $barcodeOPT, $renderOPT)->render();
 }
示例#17
0
 public function generate($code)
 {
     //load library
     $this->load->library('zend');
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     //Zend_Barcode::render('code128', 'image', array('text'=>$code), array());
     $barcodeOptions = array('text' => $code);
     $rendererOptions = array('imageType' => 'png', 'horizontalPosition' => 'center', 'verticalPosition' => 'middle');
     $imageResource = Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions)->render();
     return $imageResource;
 }
示例#18
0
 /**
  * Return barcode image
  */
 public function getImage($barcode)
 {
     $barcodeStandard = Mage::getStoreConfig('barcodelabel/general/standard');
     // WARNING option withChecksum = false is ignored for EAN 13 ! we have to cut the barcode if ean13 is enable
     if ($barcodeStandard == "Ean13") {
         $barcode = substr($barcode, 0, 12);
     }
     $barcodeOptions = array('text' => $barcode);
     // barcode attribut (not sku!)
     $rendererOptions = array();
     // default = empty
     $factory = Zend_Barcode::factory($barcodeStandard, 'image', $barcodeOptions, $rendererOptions);
     $image = $factory->draw();
     return $image;
 }
示例#19
0
文件: image.php 项目: G-LAB/glab-cms
	function barcode () {
	
		require 'Zend/Barcode.php';
		//require 'Zend/Barcode/Object/Code39.php';
		//require 'Zend/Barcode/Renderer/Image.php';
		
		$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
		$rendererOptions = array();
		
		try {
			$barcode = Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions);
		} catch (Exception $e) {
		    echo 'Caught exception: ',  $e->getMessage(), "\n";
		}
		
		print_r($barcode);
	}
示例#20
0
文件: SvgTest.php 项目: netvlies/zf
 public function testDrawWithExistantResourceReturnResource()
 {
     Zend_Barcode::setBarcodeFont(dirname(__FILE__) . '/../Object/_fonts/Vera.ttf');
     $barcode = new Zend_Barcode_Object_Code39(array('text' => '0123456789'));
     $this->_renderer->setBarcode($barcode);
     $svgResource = new DOMDocument();
     $rootElement = $svgResource->createElement('svg');
     $rootElement->setAttribute('xmlns', "http://www.w3.org/2000/svg");
     $rootElement->setAttribute('version', '1.1');
     $rootElement->setAttribute('width', 500);
     $rootElement->setAttribute('height', 300);
     $svgResource->appendChild($rootElement);
     $this->_renderer->setResource($svgResource);
     $resource = $this->_renderer->draw();
     $this->assertTrue($resource instanceof DOMDocument);
     $this->assertSame($resource, $svgResource);
     Zend_Barcode::setBarcodeFont('');
 }
 public function getimageAction()
 {
     $params = $this->getRequest()->getParams();
     $type = $params['type'];
     $code = $params['text'];
     if (isset($params['customize']) && $params['customize']) {
         $heigth = $params['heigth_barcode'];
         $barcodeOptions = array('text' => $code, 'barHeight' => $heigth, 'fontSize' => $params['font_size'], 'withQuietZones' => true);
     } else {
         $barcodeOptions = array('text' => $code, 'fontSize' => $params['font_size'], 'withQuietZones' => true);
     }
     // No required options
     $rendererOptions = array();
     // Draw the barcode in a new image,
     // send the headers and the image
     $imageResource = Zend_Barcode::factory($type, 'image', $barcodeOptions, $rendererOptions);
     imagepng($imageResource->draw(), Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . 'inventorybarcode' . DS . 'images' . DS . 'barcode' . DS . 'barcode.png');
     $imageResource->render();
 }
示例#22
0
 public function indexAction()
 {
     $product_id = $this->getRequest()->getParam('product_id');
     if (!isset($product_id) || !is_numeric($product_id)) {
         exit;
     }
     $eanprefix_code = '012345';
     $product = Mage::getModel('catalog/product')->load($product_id);
     $ean_code = $this->ean13_check_digit($eanprefix_code . str_pad($product->getId(), 5, "0", STR_PAD_LEFT));
     //var_dump($ean_code);die();
     include_once Mage::getBaseDir('lib') . 'Zend/Barcode.php';
     $barcodeOptions = array('text' => $ean_code);
     $rendererOptions = array();
     try {
         $renderer = Zend_Barcode::factory('ean13', 'image', $barcodeOptions, $rendererOptions)->render();
     } catch (Exception $e) {
     }
     exit;
 }
 /**
  * Draw the barcode in the rendering resource
  * @return mixed
  */
 public function draw()
 {
     try {
         $this->checkParams();
         $this->_initRenderer();
         $this->_drawInstructionList();
     } catch (Zend_Exception $e) {
         $renderable = false;
         if ($e instanceof Zend_Barcode_Exception) {
             $renderable = $e->isRenderable();
         }
         if ($this->_automaticRenderError && $renderable) {
             $barcode = Zend_Barcode::makeBarcode('error', array('text' => $e->getMessage()));
             $this->setBarcode($barcode);
             $this->_resource = null;
             $this->_initRenderer();
             $this->_drawInstructionList();
         } else {
             if ($e instanceof Zend_Barcode_Exception) {
                 $e->setIsRenderable(false);
             }
             throw $e;
         }
     }
     return $this->_resource;
 }
示例#24
0
 public function testProxyBarcodeObjectFont()
 {
     Zend_Barcode::setBarcodeFont('my_font.ttf');
     $barcode = new Zend_Barcode_Object_Code25();
     $this->assertSame('my_font.ttf', $barcode->getFont());
     Zend_Barcode::setBarcodeFont('');
 }
 public function gerarcodigodebarrasAction()
 {
     //$this->_helper->layout->disableLayout();
     $pronac = $_GET['pronac'];
     $barcodeOptions = array('text' => $pronac);
     $rendererOptions = array();
     $codigo = Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions)->draw();
     copy($codigo, 'D:/imagem');
     //xd($codigo);
 }
示例#26
0
 /**
  * Generate barcode for books.
  * 
  * Generate barcode in CODE39.
  * @param string text - The text to be printed as barcode.
  */
 public function generatecodeAction()
 {
     $request = $this->getRequest();
     $text = $request->getParam('text');
     $format = $request->getParam('format', 'CODE39');
     $barcodeOptions = array('text' => $text);
     $rendererOptions = array();
     $this->getResponse()->setHeader('Cache-Control', 'public, proxy-revalidate')->setHeader('Set-Cookie', '', true);
     Zend_Barcode::render($format, 'image', $barcodeOptions, $rendererOptions);
 }
示例#27
0
 /**
  * @expectedException Zend_Barcode_Renderer_Exception
  */
 public function testNoFontWithOrientation()
 {
     Zend_Barcode::setBarcodeFont('');
     $barcode = new Zend_Barcode_Object_Code39(array('text' => '0123456789'));
     $barcode->setOrientation(1);
     $this->_renderer->setBarcode($barcode);
     $this->_renderer->draw();
 }
示例#28
0
    require_once LIB . 'Zend/Barcode.php';
    $act = isset($get->act) ? trim($get->act) : 'save';
    $output = isset($get->output) ? trim($get->output) : 'image';
    $ext = $output == 'image' ? $mode : 'pdf';
    $file_name = '../../images/barcodes/' . $code . '.' . $ext;
    $options = array('text' => $code);
    //$options['barHeight'] = 50;
    //$options['barThickWidth'] = 3;
    //$options['barThinWidth'] = 1;
    $options['factor'] = $scale;
    //$options['foreColor'] = "#000000";
    //$options['backgroundColor'] = "#FFFFFF";
    //$options['reverseColor'] = FALSE;
    //$options['orientation'] = 0;
    $options['font'] = "./DejaVuSans.ttf";
    //$options['fontSize'] = 10;
    //$options['withBorder'] = FALSE;
    //$options['withQuietZones'] = TRUE;
    //$options['drawText'] = TRUE;
    //$options['stretchText'] = FALSE;
    //$options['withChecksum'] = FALSE;
    //$options['withChecksumInText'] = FALSE;
    // output the barcode
    $renderer = Zend_Barcode::factory($encoding, $output, $options, array());
    if ($act == 'save') {
        call_user_func('image' . $mode, $renderer->draw(), $file_name);
    } else {
        $renderer->render();
    }
}
exit;
示例#29
0
 public function tearDown()
 {
     Zend_Barcode::setBarcodeFont('');
 }
示例#30
-10
 /**
  * [createBarcode description]
  * @param  string $type   [Code128,Code25,Code25interleaved,Ean2,Ean5,Ean8,Ean13,Code39,Identcode,Itf14,Upca,Upce]
  * @param  string $str    [Kode Barcode]
  * @param  string $height [optional height]
  * @param  string $width  [optional width]
  * @return [type]         [description]
  */
 function createBarcode($type, $str, $height = '48', $width = '1.7')
 {
     $this->CI->load->library('ext/zend', 'Zend/Barcode');
     $barcodeOPT = array('text' => $str, 'barHeight' => $height, 'factor' => $width, 'drawText' => TRUE);
     $renderOPT = array();
     $render = Zend_Barcode::factory($type, 'image', $barcodeOPT, $renderOPT)->render();
 }