<?php
// Define variable to prevent hacking
define('IN_CB',true);

// Including all required classes
//require(GTFWConfiguration::GetValue('application', 'gtfw_base') . '/main/lib/barcode/class/index.php');
include(GTFWConfiguration::GetValue('application', 'docroot') . '/main/lib/phpqrcode/qrlib.php');

class ViewQrcode extends ImgResponse
{
   /* function GetFileName()
   {
      return 'qrcode.png';
   } */
   
   function ProcessRequest ()
   {
		$getData		= $_GET['data']->raw();
		$getSize		= $_GET['size']->raw();
		$getLevel	= $_GET['level']->raw();
		
      $data 	= (isset($getData)) ? $getData : 'GTFW Qrcode Generator';
      $size 	= (isset($getSize)) ? $getSize : 5;
		$level 	= (isset($getLevel)) ? $getLevel : 'H';
		
      // including the qrcode
      
		
		///for($i=0; $i<sizeof($data); $i++)
		//{
		//header('Content-Type: image/png');
		
		$filename = $data/*'.png'*/;
		$result = QRcode::png($data, $filename, $level, $size, 2); 
		//print_r($result);
		//}
		//echo '<img src="'.$filename.'">';
		
		//exit;
      // Header that says it is an image (remove it if you save the barcode to a file)
      
		//exit;
      // Draw (or save) the image into PNG format.
      // $drawing->finish(IMG_FORMAT_PNG);
      return $filename;
   }
}
?>