【问题标题】:Zend framework how to set barcode height and width?Zend框架如何设置条码高宽?
【发布时间】:2017-02-09 10:13:06
【问题描述】:
   $CI=& get_instance();    
   $CI->load->library('zend');
   $CI->zend->load('Zend/Barcode');
   $barcode_image_name = "123456789000";


    $barcodeOptions = array(
            'text' => "123456789000", 
            'barHeight'=> 100,
            'factor'=>4,

    );


   $file = Zend_Barcode::draw('code128', 'image', $barcodeOptions, array());

   $store_image = imagepng($file,FCPATH."uploads/barcodeImage/{$barcode_image_name}.png");
   return $store_image;

这是我在 Codeigniter Frameword 中加载 xend 库的代码,现在我想设置条形码的宽度和高度...

【问题讨论】:

标签: codeigniter zend-framework width barcode


【解决方案1】:

条形码的宽度由barcodeParams barHeightfactor 定义。没有手动设置宽度的选项。

来源:https://framework.zend.com/manual/1.12/en/zend.barcode.objects.html

【讨论】:

    【解决方案2】:

    我正在使用 CSS 设置生成的条形码图像的高度和宽度。

    <img class='barcode-image' 
         src='" . site_url() . "controllers/function_setbarcode/" . $your_code . "' 
         alt='Barcode' />
    

    我必须设置高度和宽度

    img.barcode-image {
        width: auto;
        height: 65%;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-05
      • 2012-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多