public function getCouponText(Pap_Db_Coupon $coupon) { $couponFormat = $this->getData3(); $couponFormat = str_replace('{$couponcode}', $coupon->getCode(), $couponFormat); $couponFormat = str_replace('{$couponid}', $coupon->getId(), $couponFormat); $couponFormat = str_replace('{$validfrom}', $coupon->get(Pap_Db_Table_Coupons::VALID_FROM), $couponFormat); $couponFormat = str_replace('{$validto}', $coupon->get(Pap_Db_Table_Coupons::VALID_TO), $couponFormat); $couponFormat = str_replace('{$limituse}', ($coupon->get(Pap_Db_Table_Coupons::MAX_USE_COUNT) == 0 ? $this->_('unlimited') : $coupon->get(Pap_Db_Table_Coupons::MAX_USE_COUNT)), $couponFormat); if (strstr($couponFormat, '{$barcodeimage}') !== false) { $barCode = new Gpf_BarCode_BarCode(); $couponFormat = str_replace('{$barcodeimage}', $barCode->getLink($coupon->getId()), $couponFormat); } if (strstr($couponFormat, '{$qrcodeimage}') !== false) { $QrCode = new Gpf_QrCode_QrCode(); $couponFormat = str_replace('{$qrcodeimage}', $QrCode->getLink($coupon->getCode()), $couponFormat); } return $couponFormat; }
/** * Output bar code image to the browser * * @param $code */ public function getImage($imageCode) { header("Content-Type: image/png"); $qrimage = imagecreatefrompng(Gpf_QrCode_QrCode::getQrImageUrl($imageCode)); imagepng($qrimage); }
<?php require_once 'bootstrap.php'; $qrCodeImage = new Gpf_QrCode_QrCode(); $qrCodeImage->getImage($_REQUEST[Gpf_QrCode_QrCode::QR_IMAGE_CODE]); ?>