我正在将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="">
答案 0 :(得分:0)
该功能是生成基于文件的数据而不是路径文件信息,因此您应该将视图更改为生成文件的链接,因为html需要路径源