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); } }