代码点火器zend条码库不起作用

问题描述

我正在将Zend Barcode库用于我的codeigniter项目。 以前工作正常。但是,现在我得到的是空白图像而不是条形码 我该如何解决这个问题?

控制器

 <?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Printing extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->library('zend');
    }

    public function bar_code()
    {
        $page  = 'barcode';
        $ch_id = $this->session->user['church_id'];

        $data['tbl_data'] = $this->print_model->members_barcode($ch_id);
        $data['off_type']     = $off_type;
        $data['church_name']  = $this->session->user['church_name'];
        $data['main_content'] = 'print/'.$page;
        $this->load->view('index',$data);
    }

    //Barcode Render
    public function barcode($data)
    {
        $this->zend->load('zend/barcode');
        Zend_Barcode::render(
            'code128','image',array(
                'text' => $data,'barHeight' => 35,'drawText' => FALSE,'withQuietZones' => FALSE,'barWidth' => 100,));
    }
}

视图

<img class="br-img" src="<?php echo site_url('printing/barcode/'.$value->mem_tbl_id.$off_type); ?>" alt="">

预览

enter image description here

解决方法

该功能是生成基于文件的数据而不是路径文件信息,因此您应该将视图更改为生成文件的链接,因为html需要路径源

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...