如何在html页面中渲染Zend_Barcode? [英] How can I render a Zend_Barcode inside a html page?

查看:246
本文介绍了如何在html页面中渲染Zend_Barcode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个应用程序与Codeignitor配合使用,并使用Zend_Barcode库创建条形码,

One of my application devoloped with Codeignitor and create a barcode using Zend_Barcode library,

参考: http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/

如何在codeignitor视图上显示条形码。
尝试为

How can I show the barcode on codeignitor view. Tried as ,

// Only the text to draw is required
$barcodeOptions = array('text' => 'NOT-ME');

// No required options
$rendererOptions = array();

// Draw the barcode in a new image,
$imageResource = Zend_Barcode::draw(
    'code39', 'image', $barcodeOptions, $rendererOptions
);

$data['barcode'] = imagejpeg($imageResource, 'barcode.jpg', 100);

// Free up memory
imagedestroy($imageResource); 

查看

<img src="<?php echo $barcode;?>">

但它失败:(

推荐答案

而不是

Zend_Barcode::draw('code39', 'image', $barcodeOptions, $rendererOptions);

使用

Zend_Barcode::render('code39', 'image', $barcodeOptions, $rendererOptions);

这篇关于如何在html页面中渲染Zend_Barcode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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