我试图使用zend库条形码使条形码degnan,条形码在完美运行时出现,但他的展示柜已满,如何将条形码的结果显示到iframe或img???
这是我的控制器
class Contohbarcode extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$this->load->view('insertcode');
}
function bikin_barcode() {
$this->load->library('zend');
$this->zend->load('Zend/Barcode');
$barcode = $this->input->post('barcode');
Zend_Barcode::render('code128', 'image', array('text'=>$barcode), array());
}
}
查看插入代码
<form method="post" action="<?php echo base_url(); ?>contohbarcode/bikin_barcode" class="form-horizontal">
<div align="center">
<input name="barcode" id="location" type="text" placeholder="insert your code">
</p>
<input type="submit" class="btn" name="submit" value="Find">
</div>
</form>
首先,您需要将其保存到变量,然后使用例如 imagepng
,然后您可以将该条形码显示为简单图像
$imageResource = Zend_Barcode::factory('code128', 'image', array('text'=>$barcode), array())->draw();
imagepng($imageResource, 'public_html/img/barcode.png');
关于将条形码保存到图像的 Zend 教程资源
PHP.net 关于图像PNG