使用带有库zend条码的codeigniter创建显示条码 [英] Create display barcode using codeigniter with library zend barcode

查看:45
本文介绍了使用带有库zend条码的codeigniter创建显示条码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用zend库中的条形码制作条形码degnan,条形码在完美运行时会出现,但他的展示柜已满,如何将条形码中的结果显示到iframe或img中?

I tried to make the barcode degnan using zend library barcode , barcode appear when running perfectly but his display case full , how to display results in a barcode into an iframe or 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 ,然后您可以将该条形码显示为简单图像

First you need to save it to variable and then save it to file using e.g. imagepng, and then you can display that barcode as simple image

$imageResource = Zend_Barcode::factory('code128', 'image', array('text'=>$barcode), array())->draw();
imagepng($imageResource, 'public_html/img/barcode.png');

有关保存的Zend教程条形码到imageResource

有关imagepng的PHP.net

这篇关于使用带有库zend条码的codeigniter创建显示条码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆