Created
October 27, 2011 07:18
-
-
Save juriansluiman/1318966 to your computer and use it in GitHub Desktop.
Barcode view helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Soflomo_View_Helper_Barcode extends Zend_View_Helper_Abstract | |
{ | |
public function barcode ($text, $type = 'code128', $options = array()) | |
{ | |
$options = array('text' => $text) + $options; | |
$resource = Zend_Barcode::draw( | |
$type, 'image', $options, array() | |
); | |
ob_start(); | |
imagepng($resource); | |
$data = ob_get_clean(); | |
return base64_encode($data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment