本文整理汇总了PHP中Zend_Barcode::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Barcode::factory方法的具体用法?PHP Zend_Barcode::factory怎么用?PHP Zend_Barcode::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Barcode
的用法示例。
在下文中一共展示了Zend_Barcode::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBarcodeImgSource
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;
}
示例2: generateBarcodeAction
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();
}
示例3: barcode_generate
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();
}
示例4: set_barcode
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();
}
示例5: gambar
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();
}
示例6: generate
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;
}
示例7: getImage
/**
* 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;
}
示例8: barcode
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);
}
示例9: getimageAction
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();
}
示例10: indexAction
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;
}
示例11: testFactoryWithExistingBarcodeObject
public function testFactoryWithExistingBarcodeObject()
{
$this->_checkGDRequirement();
$barcode = new Zend_Barcode_Object_Code25();
$renderer = Zend_Barcode::factory($barcode);
$this->assertSame($barcode, $renderer->getBarcode());
}
示例12: gerarcodigodebarrasAction
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);
}
示例13: isset
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;
示例14: getBarcodeImageFile
public function getBarcodeImageFile($text, $resultType = 'url')
{
$text = strtoupper($text);
$fileName = preg_replace('/[^0-9A-Z-]/', '', $text);
$cacheDir = Mage::getModel('core/config')->getVarDir() . self::BARCODE_CACHE_DIR;
for ($distriDepth = 0; $distriDepth < self::BARCODE_CACHE_DISTRI_DEPTH; $distriDepth++) {
$cacheDir .= strlen($fileName) > $distriDepth ? '/' . $fileName[$distriDepth] : '';
}
$cachePath = $cacheDir . DS . $fileName . '.' . self::BARCODE_IMAGE_TYPE;
if (!file_exists($cachePath)) {
if (!file_exists($cacheDir)) {
mkdir($cacheDir, 0777, true);
}
$config = new Zend_Config(array('barcode' => 'code39', 'barcodeParams' => array('text' => $text), 'renderer' => 'image', 'rendererParams' => array('imageType' => self::BARCODE_IMAGE_TYPE)));
$barcode = Zend_Barcode::factory($config);
$imageFunction = 'image' . self::BARCODE_IMAGE_TYPE;
$result = $imageFunction($barcode->draw(), $cachePath);
if (!$result) {
return false;
}
}
switch ($resultType) {
case 'url':
$result = Mage::getUrl('', array('_direct' => str_replace(Mage::getBaseDir() . DS, '', $cachePath)));
break;
case 'magepath':
$result = str_replace(Mage::getBaseDir() . DS, '', $cachePath);
break;
case 'fullpath':
default:
$result = $cachePath;
}
return $result;
}
示例15: gen_barcode
function gen_barcode($product_code = NULL, $height = 60, $width = 210)
{
if ($this->input->get('code')) {
$product_code = $this->input->get('code');
}
if ($this->input->get('height')) {
$height = $this->input->get('height');
}
if ($this->input->get('width')) {
$width = $this->input->get('width');
}
$this->load->library('zend');
$this->zend->load('Zend/Barcode');
//'drawText' => FALSE
$barcodeOptions = array('text' => $product_code, 'barHeight' => $height);
$rendererOptions = array('imageType' => 'png', 'horizontalPosition' => 'center', 'verticalPosition' => 'middle', 'width' => $width);
$imageResource = Zend_Barcode::factory(BARCODE_SYMBOLOGY, 'image', $barcodeOptions, $rendererOptions)->render();
return $imageResource;
}