Skip to content

Instantly share code, notes, and snippets.

@juriansluiman
Created October 27, 2011 07:18
Show Gist options
  • Save juriansluiman/1318966 to your computer and use it in GitHub Desktop.
Save juriansluiman/1318966 to your computer and use it in GitHub Desktop.
Barcode view helper
<?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