require_once 'app_code/class.Event_Contacts.php'; require_once 'class/class.local_calendar.php'; ob_end_clean(); $casecreation = new case_creation(); $case = $_REQUEST['case_id']; $data = $casecreation->get_case_data($case); $use_data = array(); $use_data['case_id'] = $data['case_id']; //$use_data['company_name'] = $data['company_name']; //ini_set('display_errors' , 1 ); $font = "freefont/FreeSansBold.ttf"; //header('Content-Type: image/gif'); require_once 'class/class.qrcode.php'; require_once 'class/class.print.php'; $qr = new QR(json_encode($use_data)); $image = $qr->image(); $qrsize = 140; $img2 = imagecreatefromstring($image); $img = imagecreatetruecolor($qrsize, $qrsize); imagecopyresized($img, $img2, 0, 0, 0, 0, $qrsize, $qrsize, imagesx($img2), imagesy($img2)); $width = 420; $height = 130; $im = imagecreatetruecolor($width, $height); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, (int) $width - 1, (int) $height - 1, $white); imagecopymerge($im, $img, 0, 0, 0, 0, $height, $height, 100); // Create some colors //imagettftext($im, 12, 0, 150 , , $grey, $font, $order); $height_offset = 8;
/** * Output a QR Code image * * @since 3.1 */ public function onAjax_renderQRCode() { $app = JFactory::getApplication(); $input = $app->input; $this->setId($input->getInt('element_id')); $this->loadMeForAjax(); $this->getElement(); $params = $this->getParams(); $lang = JFactory::getLanguage(); $lang->load('com_fabrik.plg.element.field', JPATH_ADMINISTRATOR); if (!$this->canView()) { $app->enqueueMessage(JText::_('PLG_ELEMENT_FIELD_NO_PERMISSION')); $app->redirect($url); exit; } $rowid = $input->get('rowid', '', 'string'); if (empty($rowid)) { $app->enqueueMessage(JText::_('PLG_ELEMENT_FIELD_NO_SUCH_FILE')); $app->redirect($url); exit; } $repeatcount = $input->getInt('repeatcount', 0); $listModel = $this->getListModel(); $row = $listModel->getRow($rowid, false); if (empty($row)) { $app->enqueueMessage(JText::_('PLG_ELEMENT_FIELD_NO_SUCH_FILE')); $app->redirect($url); exit; } $elName = $this->getFullName(true, false); $value = $row->{$elName}; require JPATH_SITE . '/components/com_fabrik/libs/qrcode/qrcode.php'; // Usage: $a=new QR('234DSKJFH23YDFKJHaS');$a->image(4); $qr = new QR($value); $img = $qr->image(4); if (!empty($img)) { // Some time in the past header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header('Accept-Ranges: bytes'); header('Content-Length: ' . strlen($img)); header('Content-Type: ' . 'image/gif'); // Serve up the file echo $img; // And we're done. exit; } else { $app->enqueueMessage(JText::_('PLG_ELEMENT_FIELD_NO_SUCH_FILE')); $app->redirect($url); exit; } }