public function actionGenerateSignatureQR() { if (Yii::app()->user->id) { $QRSignature = new SignatureQRCodeGenerator(); // TODO: need to get a unique code for the user and add a key here! $user = User::model()->findByPk(Yii::app()->user->id); $user_code = $this->getUniqueCodeForUser(); if (!$user_code) { throw new CHttpException('Could not get unique code for user - unique codes might need to be generated'); } $finalUniqueCode = $user->generateUniqueCodeWithChecksum($user_code); $QRimage = $QRSignature->createQRCode("@U:1@code:" . $finalUniqueCode . "@key:" . md5(Yii::app()->user->id), 250); // Output and free from memory header('Content-Type: image/jpeg'); imagejpeg($QRimage); imagedestroy($QRimage); } }
/** * @return resource */ public function getSignatureBox() { $QRContent = "@code:" . \Yii::app()->moduleAPI->get('OphCoCvi')->getUniqueCodeForCviEvent($this->event) . "@key:" . $this->getEncryptionKey(); $QRHelper = new \SignatureQRCodeGenerator(); return $QRHelper->generateQRSignatureBox($QRContent, true, array("x" => 1000, "y" => 600), 200); }