/** * Output bar code image to the browser * * @param $code */ public function getImage($imageCode) { if (!$this->isValid($imageCode)) { throw new Gpf_BarCode_Exception('Image code is not valid'); } $barCodeImage = new Gpf_BarCode_Image(); $barCodeImage->setSize(180, 120); $barCodeImage->setCode($imageCode); $barCodeImage->generate(); }
private function init() { self::$barCodes = array(); self::$barCodes[self::CODE_TYPE_INTERLEAVED_2_OF_5] = 'Gpf_BarCode_Type_I25'; self::$barCodes[self::CODE_TYPE_39] = 'Gpf_BarCode_Type_C39'; self::$barCodes[self::CODE_TYPE_128A] = 'Gpf_BarCode_Type_C128A'; self::$barCodes[self::CODE_TYPE_128B] = 'Gpf_BarCode_Type_C128B'; self::$barCodes[self::CODE_TYPE_128C] = 'Gpf_BarCode_Type_C128C'; // All constants is defined in class Gpf_BarCode_Type_BarCode $this->style = 0 | 4 | 64 | 128; $this->width = 460; $this->height = 120; $this->font = 5; $this->xres = 2; }