Пример #1
2
<?php

$data = 'QRコードは、(株)デンソーウェーブの登録商標です。';
$data = mb_convert_encoding($data, 'SJIS-win', 'UTF-8');
// クラス QRCode
$qr = new QRCode(array('version' => 1, 'maxnum' => 16, 'mode' => QRCode::EM_KANJI));
// データを入力
$qr->addData($data);
// 終了処理、これ以後のデータ入力は不可
// 終了処理をせずに出力しようとするとエラー
$qr->finalize();
// 出力設定は初期化時、終了処理前、終了処理後のいつでもできる
$qr->setFormat(QRCode::FMT_TIFF);
$qr->setMagnify(2);
$qr->setOrder(-1);
// 出力
var_dump($qr->getMimeType());
$qr->outputSymbol('qr.tiff');
// Iterator としてシンボルを一つずつ取得できる
$qr->setFormat(QRCode::FMT_BMP);
foreach ($qr as $pos => $symbol) {
    file_put_contents(sprintf('qr%d.bmp', $pos + 1), $symbol);
}
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Quiz grading report version information.
 *
 * @package    quiz
 * @subpackage papercopy
 * @copyright  2012 Binghamton Universtiy
 * @author     Kyle J. Temkin <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
include 'phpqrcode/qrlib.php';
// Only run if we have the necessary params.
if (empty($_GET['quba']) || empty($_GET['q']) || empty($_GET['qa'])) {
    die('Missing params.');
}
// Generate a QR Code with the relevant information.
QRCode::png($_GET['quba'] . '|' . $_GET['q'] . '|' . $_GET['qa'], false, 'Q', 5);
Пример #3
1
 function getMinimumQRCode($data, $errorCorrectLevel)
 {
     $mode = QRUtil::getMode($data);
     $qr = new QRCode();
     $qr->setErrorCorrectLevel($errorCorrectLevel);
     $qr->addData($data, $mode);
     $qrData = $qr->getData(0);
     $length = $qrData->getLength();
     for ($typeNumber = 1; $typeNumber <= 10; $typeNumber++) {
         if ($length <= QRUtil::getMaxLength($typeNumber, $mode, $errorCorrectLevel)) {
             $qr->setTypeNumber($typeNumber);
             break;
         }
     }
     $qr->make();
     return $qr;
 }
 public function index()
 {
     import('QRCode');
     $QRCode = new QRCode('', 150);
     $img_url = $QRCode->getUrl("http://blog.51edm.org");
     echo '<img src="' . $img_url . '" />';
 }
 protected function getQRCode($url = NULL)
 {
     if (IS_POST) {
         $this->assign("QRcodeUrl", "");
     } else {
         //            $url = empty($url) ? C('WEB_ROOT') . $_SERVER['REQUEST_URI'] : $url;
         $url = empty($url) ? C('WEB_ROOT') . U(MODULE_NAME . '/' . ACTION_NAME) : $url;
         import('QRCode');
         $QRCode = new QRCode('', 80);
         $QRCodeUrl = $QRCode->getUrl($url);
         $this->assign("QRcodeUrl", $QRCodeUrl);
     }
 }
Пример #6
0
function generarQR($url)
{
    $tempDir = __DIR__ . '/../img/';
    $fileName = "qrcode.png";
    $pngAbsoluteFilePath = $tempDir . $fileName;
    QRCode::png($url, $pngAbsoluteFilePath, 'L', '4', '4');
    return $pngAbsoluteFilePath;
}
Пример #7
0
 /**
  * Output a QRCode containing the URL of the Jorani instance and the e-mail of the connected user
  * @author Benjamin BALET <*****@*****.**>
  */
 public function qrCode()
 {
     require_once APPPATH . 'third_party/QRCode.php';
     $this->load->model('users_model');
     $user = $this->users_model->getUsers($this->user_id);
     $qr = new QRCode();
     $qr = QRCode::getMinimumQRCode(base_url() . '#' . $user['login'] . '#' . $user['email'], QR_ERROR_CORRECT_LEVEL_L);
     echo $qr->printHTML();
 }
Пример #8
0
 function createQRCode($str)
 {
     require dirname(__FILE__) . '/ext/phpqrcode/qrlib.php';
     $rn = strtotime(date("Y-m-d H:i:s"));
     QRCode::png($str, $rn . '.png', "large", 10, 3);
     header("Content-type: image/png");
     readfile($rn . '.png');
     unlink($rn . '.png');
     exit(0);
 }
Пример #9
0
function Authenticatron_QR($URL, $Size = 4, $Margin = 0, $Level = 'M')
{
    // Require the PHPQRCode Library
    global $PHPQRCode;
    // If the required functions are not loaded, fail.
    // If the file we are about to require doesn't exist or isn't readable, fail.
    if (!extension_loaded('gd') || !function_exists('gd_info') || !is_readable($PHPQRCode)) {
        return false;
        // Otherwise proceed with PHPQRCode
    } else {
        // We've checked the file exists, so we can require instead of include.
        // Something has gone horribly wrong if this doesn't work.
        require_once $PHPQRCode;
        // Use the object cache to capture the PNG without outputting it.
        // Kind of hacky but the best way I can find without writing a new QR Library.
        ob_start();
        QRCode::png($URL, null, constant('QR_ECLEVEL_' . $Level), $Size, $Margin);
        $QR_Base64 = base64_encode(ob_get_contents());
        ob_end_clean();
        // Return it as a Base64 PNG
        return 'data:image/png;base64,' . $QR_Base64;
    }
}
Пример #10
0
<?php

require '../lib/QRCode.php';
$chart = new QRCode(150, 150);
$chart->setData('Hello world');
//~ $chart->setOutputEncoding('UTF-8');
//~ header('Content-Type: image/png');
echo $chart->toHtml();
Пример #11
0
<?php

defined("_V") || die("Direct access not allowed!");
$new = $b[$_SESSION['wallet']]->getnewaddress($_SESSION['btaccount']);
$file = "cache/" . $new . ".png";
if (isset($phpqrcode)) {
    include $phpqrcode;
    if (!file_exists($file)) {
        QRCode::png($new, $file);
    }
}
echo $new;
Пример #12
0
          imagerectangle($im, 599, 0, 899, 299, $black); 
          imagettftext($im, 10, 0, 690, 290, $black, $font, 'IMAGE ROTATION'); 
          /**/
        // -------------------------------------------------- //
        //                    MIDDLE AXE
        // -------------------------------------------------- //
        //imageline($im, $x, 0, $x, 250, $red);
        //imageline($im, 0, $y, 250, $y, $red);
        // -------------------------------------------------- //
        //                  BARCODE BOUNDARIES
        // -------------------------------------------------- //
        //for($i=1; $i<5; $i++){
        //  drawCross($im, $blue, $data['p'.$i]['x'], $data['p'.$i]['y']);
        //}
        // -------------------------------------------------- //
        //                    GENERATE
        // -------------------------------------------------- //
        header('Content-type: image/gif');
        imagepng($im);
        imagedestroy($im);
    } else {
        if (isset($_REQUEST['QRCODE'])) {
            require_once DIR_LIB . "phpqrcode/qrlib.php";
            QRCode::png($_REQUEST['QRCODE']);
        } else {
            $HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
            $server->service($HTTP_RAW_POST_DATA);
            exit;
        }
    }
}
Пример #13
0
 public function getQrCode()
 {
     $base = Yii::getPathOfAlias('webroot');
     $urlPath = '/images/user_boxes/qr/' . $this->user_box_id . '.png';
     $filePath = $base . $urlPath;
     $url = 'http://' . Yii::app()->request->serverName;
     $url .= Yii::app()->createUrl('customerBox/setDelivered', array('id' => $this->user_box_id));
     Yii::import('boxomatic.extensions.qrcode.QRCode');
     $code = new QRCode($url);
     $code->create($filePath);
     return Yii::app()->request->baseUrl . $urlPath;
 }
Пример #14
0
 public function actionQrcode()
 {
     $orderId = Yii::app()->request->getParam('orderId', 0);
     $dpid = Yii::app()->request->getParam('dpid', 0);
     $url = 'http://menu.wymenu.com/wymenuv2/product/weixPayOrder/orderId/' . $orderId . '?dpid=' . $dpid;
     $imgurl = './qrcode/wxpay/wxpay' . $dpid . '-' . $orderId . '.png';
     $code = new QRCode($url);
     $code->create($imgurl);
     echo $imgurl;
     exit;
 }
Пример #15
0
 private function populateData()
 {
     $this->bgColorRGB = QrTagShape::hex2dec($this->bgColor);
     $data = QRCode::text($this->text, false, $this->error_level);
     $data = array_map('str_split', $data);
     array_walk_recursive($data, 'intval');
     $this->data = $data;
     if ($this->dot instanceof QrTagShape && !$this->dot instanceof QrTagEffect) {
         $this->dot->bgColorRGB = $this->bgColorRGB;
         $this->dotImg = $this->dot->generate();
         if (!is_resource($this->dotImg)) {
             throw new Exception('Dot must generate a valid image resource.');
         }
     } else {
         if ($this->dot instanceof QrTagEffect) {
             $this->dot->bgColorRGB = $this->bgColorRGB;
             $this->dot->generate();
         }
     }
     if (!$this->frameDot instanceof QrTagShape) {
         $this->frameDot->bgColorRGB = $this->bgColorRGB;
         throw new Exception('Frame Dot must be instance of QrTagShape class.');
     }
     $this->frameDot->size = $this->dot->markerSize ? $this->dot->markerSize : $this->dot->size;
     $this->frameDotImg = $this->frameDot->generate();
     if (!$this->frame instanceof QrTagShape) {
         throw new Exception('Frame must be instance of QrTagShape class.');
     }
     $this->frame->bgColorRGB = $this->bgColorRGB;
     $this->frame->size = $this->dot->size;
     $this->frameImg = $this->frame->generate();
     $this->cols = count($this->data[0]);
     $this->rows = count($this->data);
     $this->width = $this->cols * $this->dot->size;
     $this->height = $this->rows * $this->dot->size;
     $this->image = imagecreatetruecolor($this->width, $this->height);
     // transparent
     imagefilledrectangle($this->image, 0, 0, $this->width, $this->height, imagecolorallocate($this->image, $this->bgColorRGB[0], $this->bgColorRGB[1], $this->bgColorRGB[2]));
 }
Пример #16
0
 public function actionGenerateTransQr()
 {
     self::registerImageQrAutoloader();
     Yii::import('ext.qr.phpqrcode.qrlib', true);
     $model = Qr::model()->findByPk(Yii::app()->session['qr_id']);
     $size = isset($_GET['size']) ? intval($_GET['size']) : 0;
     $x = isset($_GET['x']) ? intval($_GET['x']) : 0;
     $y = isset($_GET['y']) ? intval($_GET['y']) : 0;
     $imgTmp = imagecreatefromstring(file_get_contents(Yii::app()->session['trans_qr_code_file']));
     $img = imagecreatetruecolor(imagesx($imgTmp), imagesy($imgTmp));
     imagefill($img, 0, 0, imagecolorallocatealpha($img, 255, 255, 255, 127));
     imagecopymerge($img, $imgTmp, 0, 0, 0, 0, imagesx($imgTmp), imagesy($imgTmp), 100);
     imagedestroy($imgTmp);
     imagesavealpha($img, true);
     $size = $size < 100 ? min(array(imagesx($img), imagesy($img))) : $size;
     $data = QRCode::text($model->tag_url, false, 'Q');
     $data = array_map('str_split', $data);
     array_walk_recursive($data, 'intval');
     $qr = new \Madlogics\VisualQr($img);
     $qr->setData($data);
     $qr->setSize($size)->setX($x)->setY($y);
     header('Content-Type: image/png');
     $im2 = $qr->render()->getImageQrIm();
     imagepng($im2);
     imagepng($im2, $model->image_path);
     exit;
 }
Пример #17
0
 public function createPatientQrCode($pid, $fullname)
 {
     $data = '{"name":"' . $fullname . '","pid":' . $pid . ',"ehr": "GaiaEHR"}';
     include ROOT . '/lib/phpqrcode/qrlib.php';
     ob_start();
     QRCode::png($data, false, 'Q', 2, 2);
     $imageString = base64_encode(ob_get_contents());
     ob_end_clean();
     return 'data:image/jpeg;base64,' . $imageString;
 }
Пример #18
0
<?php

require_once '../lib/lib.everything.php';
require_once '../lib/lib.qrcode.php';
enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']);
/**** ... ****/
$url = 'http://' . get_domain_name() . get_base_dir() . '/atlas.php?id=' . urlencode($_GET['print']);
$qrc = QRCode::getMinimumQRCode($url, QR_ERROR_CORRECT_LEVEL_Q);
$img = $qrc->createImage(16, 0);
header('Content-type: image/png');
header("X-Content: {$url}");
imagepng($img);
imagedestroy($img);
Пример #19
0
 public function actionPrint($id)
 {
     if (preg_match('/^[0-9]+$/', $id)) {
         $voucher = Voucher::model()->findByPk($id);
         if ($voucher) {
             if (!is_dir(Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id)) {
                 mkdir(Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id);
             }
             if (!is_dir(Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->id)) {
                 mkdir(Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->id);
             }
             //if(!is_dir(Yii::app()->params['VOUCHERS_EXPORT_PATH'].DIRECTORY_SEPARATOR.$voucher->distributionVoucher->subdistribution->distribution->id)){
             //    mkdir(Yii::app()->params['VOUCHERS_EXPORT_PATH'].DIRECTORY_SEPARATOR.$voucher->distributionVoucher->subdistribution->distribution->id);
             //}
             $export_path = Yii::app()->params['VOUCHERS_EXPORT_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id . DIRECTORY_SEPARATOR;
             //$qr_path = Yii::app()->params['VOUCHERS_QR_PATH'].DIRECTORY_SEPARATOR.$voucher->distributionVoucher->subdistribution->distribution->id.DIRECTORY_SEPARATOR.$voucher->distributionVoucher->subdistribution->id;
             //Yii::app()->createUrl('//Utility/QrGenerate',array("qrdata"=>$voucher->code, 'qrfilename' => $voucher->ben->registration_code . "_".$voucher->distributionVoucher->value, 'qrfilepath'=> $qr_path));
             $qr_path = Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->id . DIRECTORY_SEPARATOR;
             QRCode::png($voucher->code, $qr_path . $voucher->code . ".png", QR_ECLEVEL_M, 4, 1);
             if (!headers_sent()) {
                 header('Content-Type: text/html; charset=utf-8');
             }
             $html_output = "<style type=\"text/css\">\n                        table { page-break-inside:avoid }\n                        .printing tr { text-align: center;}\n                        tr    { page-break-inside:avoid; page-break-after:auto; text-align: center;}\n                        thead { display:table-header-group }\n                        tfoot { display:table-footer-group }\n                        </style>";
             $ar_text = $voucher->distributionVoucher->subdistribution->distribution->title_ar ? $voucher->distributionVoucher->subdistribution->distribution->title_ar : $voucher->distributionVoucher->type->arabic_text;
             $en_text = $voucher->distributionVoucher->subdistribution->distribution->title_en ? $voucher->distributionVoucher->subdistribution->distribution->title_en : $voucher->distributionVoucher->type->english_text;
             $html_output .= '<table  align="center" class="printing" style=" empty-cells: show; border: 1px solid; text-align:center">
                         <tr>
                                 <td rowspan="2" colspan="2"><span style="font-size: 17pt; text-align: center;">' . $en_text . '<br />' . $ar_text . '</span></td>
                                 <td rowspan="2" style="border-left: 2px dashed;  padding: 5px 10px 0px; vertical-align:top;" align="top"><img style="height: 70px;" src="' . Yii::app()->params['ASSET_PATH'] . 'logo.gif"></img></td>
                                 <td rowspan="2" style="width: 200px;"><span style="font-size: 17pt; text-align: center; ">' . $en_text . '<br />' . $ar_text . '</span></td>
                                 <td style="height: 70px; padding-top: 5px;">' . CHtml::image(Yii::app()->baseUrl . ".." . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->donor->logo_path, "", array("style" => "width:100px;")) . '</td>
                         </tr>
                         <tr>
                                 <td><span style="font-size: 6pt; text-align: center;">
                                         ' . $voucher->distributionVoucher->subdistribution->distribution->donor->slogan_en . '<br />
                                         ' . $voucher->distributionVoucher->subdistribution->distribution->donor->slogan_ar . '
                                 </span></td>
                         </tr>
                         <tr>
                                 <td style="padding-left: 5px;font-size: 14pt; vertical-align: bottom;">ID#: ' . $voucher->ben->registration_code . '</td>
                                 <td style="text-align: center; padding: 30px 14px 0px;" rowspan="3">' . CHtml::image(Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->id . DIRECTORY_SEPARATOR . $voucher->code . ".png") . '<br />' . $voucher->code . '</td>
                                 <td style="border-left: 2px dashed;" rowspan="3"> </td>
                                 <td style="font-size: 16pt; vertical-align: bottom;">ID#: ' . $voucher->ben->registration_code . '</td>
                                 <td style="text-align: center; padding-top: 30px;" rowspan="3">' . CHtml::image(Yii::app()->params['VOUCHERS_QR_PATH'] . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->distribution->id . DIRECTORY_SEPARATOR . $voucher->distributionVoucher->subdistribution->id . DIRECTORY_SEPARATOR . $voucher->code . ".png") . '<br />' . $voucher->code . '</td>
                         </tr>
                         <tr>
                                 <td style="font-size: 16pt; vertical-align: top;">Value: $' . $voucher->distributionVoucher->value . '</td>
                                 <td style="font-size: 16pt; vertical-align: top;">Value: $' . $voucher->distributionVoucher->value . '</td>
                         </tr>
                         <tr>
                                 <td style="padding-left: 10px; vertical-align: bottom; text-align: right;">Exp: ' . date("d/m/Y", strtotime($voucher->distributionVoucher->subdistribution->end_date)) . '</td>
                                 <td style="vertical-align: bottom; text-align: right;">Exp: ' . date("d/m/Y", strtotime($voucher->distributionVoucher->subdistribution->end_date)) . '</td>
                         </tr>
                 </table><br /><br />';
             return $html_output;
         } else {
             header('Content-type: application/json', true, 200);
             echo CJSON::encode(['error' => 'No Voucher With the number ' . $id]);
         }
     } else {
         header('Content-type: application/json', true, 200);
         echo CJSON::encode(['error' => 'Invalid Request']);
     }
 }
Пример #20
0
<?php

// デフォルト値を設定
ini_set('qr.default_format', QR_FMT_PNG);
ini_set('qr.default_magnify', 3);
$qr = new QRCode();
$qr->addData('foo');
// オブジェクトを複製し、途中から異なる内容のQRコードを作成できる
$qr2 = clone $qr;
$qr->addData('bar');
$qr->finalize();
$qr->outputSymbol('foobar.png');
$qr2->addData('baz');
$qr2->finalize();
$qr2->outputSymbol('foobaz.png');
Пример #21
0
 /**
  * Output a QR Code image
  *
  * @since 3.1
  */
 public function onAjax_renderQRCode()
 {
     $input = $this->app->input;
     $this->setId($input->getInt('element_id'));
     $this->loadMeForAjax();
     $this->getElement();
     $url = 'index.php';
     $this->lang->load('com_fabrik.plg.element.field', JPATH_ADMINISTRATOR);
     if (!$this->canView()) {
         $this->app->enqueueMessage(FText::_('PLG_ELEMENT_FIELD_NO_PERMISSION'));
         $this->app->redirect($url);
         exit;
     }
     $rowId = $input->get('rowid', '', 'string');
     if (empty($rowId)) {
         $this->app->redirect($url);
         exit;
     }
     $listModel = $this->getListModel();
     $row = $listModel->getRow($rowId, false);
     if (empty($row)) {
         $this->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($value)) {
         require JPATH_SITE . '/components/com_fabrik/libs/phpqrcode/phpqrcode.php';
         ob_start();
         QRCode::png($value);
         $img = ob_get_contents();
         ob_end_clean();
     }
     if (empty($img)) {
         $img = file_get_contents(JPATH_SITE . '/media/system/images/notice-note.png');
     }
     // 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;
 }
Пример #22
0
<?php

require_once "qrcode.php";
$qr = QRCode::getMinimumQRCode("QRƒR�[ƒh", QR_ERROR_CORRECT_LEVEL_L);
header("Content-type: text/xml");
print "<qrcode>";
for ($r = 0; $r < $qr->getModuleCount(); $r++) {
    print "<line>";
    for ($c = 0; $c < $qr->getModuleCount(); $c++) {
        print $qr->isDark($r, $c) ? "1" : "0";
    }
    print "</line>";
}
print "</qrcode>";
Пример #23
0
    return $StatTracker->json($agent);
})->before($validateRequest);
$StatTracker->match("/api/{token}/token", function (Request $request, $token) use($StatTracker) {
    $agent = Agent::lookupAgentByToken($token);
    if (!$agent->isValid()) {
        return $StatTracker->abort(403);
    }
    switch ($request->getMethod()) {
        case "GET":
            $name = strtoupper(substr(str_shuffle(md5(time() . $token . rand())), 0, 6));
            $token = $agent->createToken($name);
            $url = sprintf("%s://%s", $request->getScheme(), $request->getHost());
            $url = $url . $request->getBaseUrl() . "/";
            $uri = "stattracker://token?token=%s&name=%s&agent=%s&issuer=%s";
            $uri = sprintf($uri, $token, $name, $agent->name, urlencode($url));
            $qr = new QRCode();
            $qr->setText($uri)->setSize(200)->setPadding(10);
            if ($token === false) {
                return new Response(null, 202);
            } else {
                $data = array("name" => $name, "token" => $token, "qr" => $qr->getDataUri(), "uri" => $uri);
                return $StatTracker->json($data);
            }
            break;
        case "DELETE":
            if (!$request->request->has("name")) {
                return $StatTracker->abort(400);
            }
            $name = strtoupper($request->request->get("name"));
            $r = $agent->revokeToken($name);
            if ($r === true) {
Пример #24
0
Route::get('xcat', function () {
    print_r(Prefs::getCategory());
});
Route::get('barcode/dl/{txt}', function ($txt) {
    $barcode = new Barcode();
    $barcode->make($txt, 'code128', 60, 'horizontal', true);
    return $barcode->render('jpg', $txt, true);
});
Route::get('barcode/{txt}', function ($txt) {
    $barcode = new Barcode();
    $barcode->make($txt, 'code128', 60, 'horizontal', true);
    return $barcode->render('jpg', $txt);
});
Route::get('qr/{txt}', function ($txt) {
    $txt = base64_decode($txt);
    return QRCode::format('png')->size(399)->color(40, 40, 40)->generate($txt);
});
Route::get('pdf417/{txt}', function ($txt) {
    $txt = base64_decode($txt);
    header('Content-Type: image/svg+xml');
    print DNS2D::getBarcodeSVG($txt, "PDF417");
});
Route::get('media', function () {
    $media = Product::all();
    print $media->toJson();
});
Route::get('login', function () {
    return View::make('login')->with('title', 'Sign In');
});
Route::post('login', function () {
    // validate the info, create rules for the inputs
Пример #25
-1
<?php

/**
 * @title            QR Code Example
 *
 * @author           Pierre-Henry Soria <*****@*****.**>
 * @copyright        (c) 2012-2013, Pierre-Henry Soria. All Rights Reserved.
 * @license          GNU General Public License <http://www.gnu.org/licenses/gpl.html>
 */
require 'QRCode.class.php';
// Include the QRCode class
try {
    /**
     * If you have PHP 5.4 or higher, you can instantiate the object like this:
     * (new QRCode)->fullName('...')->... // Create vCard Object
     */
    $oQRC = new QRCode();
    // Create vCard Object
    $oQRC->fullName('Pierre-Henry Soria')->nickName('PH7')->gender('M')->email('*****@*****.**')->impp('*****@*****.**')->url('http://ph-7.github.com')->note('Hello to all! I am a web developer. As hobbit, I like climbing and swimming ...')->categories('developer,designer,climber,swimmer')->photo('http://files.phpclasses.org/picture/user/1122955.jpg')->lang('en-US')->finish();
    // End vCard
    // echo '<p><img src="' . $oQRC->get(300) . '" alt="QR Code" /></p>'; // Generate and display the QR Code
    $oQRC->display();
    // Display
} catch (Exception $oExcept) {
    echo '<p><b>Exception launched!</b><br /><br />' . 'Message: ' . $oExcept->getMessage() . '<br />' . 'File: ' . $oExcept->getFile() . '<br />' . 'Line: ' . $oExcept->getLine() . '<br />' . 'Trace: <p/><pre>' . $oExcept->getTraceAsString() . '</pre>';
}
Пример #26
-1
        $content = $vcard->card;
        if (isset($_GET['debug'])) {
            echo "<pre>";
            print_r($vcard->data);
            echo "</pre>";
            exit;
        }
        //include
        require_once $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/qr/qrcode.php";
        //error correction level
        //QR_ERROR_CORRECT_LEVEL_L : $e = 0;
        //QR_ERROR_CORRECT_LEVEL_M : $e = 1;
        //QR_ERROR_CORRECT_LEVEL_Q : $e = 2;
        //QR_ERROR_CORRECT_LEVEL_H : $e = 3;
        //get the qr object
        $qr = QRCode::getMinimumQRCode($content, QR_ERROR_CORRECT_LEVEL_L);
    }
    //show the vcard as an png image
    if ($_GET['type'] == "image") {
        header("Content-type: image/png");
        $im = $qr->createImage(5, 10);
        imagepng($im);
        imagedestroy($im);
    }
    //show the vcard in an html qr code
    if ($_GET['type'] == "html") {
        $qr->make();
        $qr->printHTML();
    }
}
/*
Пример #27
-1
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once '../../config.php';
//require_once($CFG->dirroot .'/course/lib.php');
//require_once($CFG->libdir .'/filelib.php');
require_once '../../lib/phpqrcode/qrlib.php';
//require_once($CFG->dirroot .'/lib/datalib.php');
//global $USER;
//print_object($USER);
//die('abc');
//QRcode::png('Phuong123sdfkjsdkfjdskfjsjfkjdskjskjdfksjdkfjdskjfkdsjkfjskjfkdsj');
//$s = $USER->id;// $USER->firstname.'|'.$USER->lastname.'|'.$USER->id.'|'.$USER->username;
//$param = $_GET['link'];
//die ($param);
$q = $_REQUEST["link"];
//$s = $CFG->wwwroot."/rec_code/".$USER->id."?redirect=".$q;
QRCode::png($q);
//QRcode::png($USER->id.'|'.$USER->username."|".$q);
// how to save PNG codes to server
Пример #28
-2
<?php 
}
?>
    
    </select> <img src="icon/arrow.png" border="0" title="Switch to selected account" style="cursor: pointer;" onclick="document.location.href='index.php?f=switchAccount&amp;id=' + document.getElementById('active_account').options[document.getElementById('active_account').options.selectedIndex].value" alt="Switch to selected account">
      <img src="icon/book--pencil.png" border="0" title="Edit accounts" style="cursor: pointer;" onclick="document.location.href='index.php?f=accounts'" alt="Edit accounts">
</div>
<?php 
for ($x = 0; $x < count($coin_list); $x++) {
    if ($coin_code[$x] == $activeCoin) {
        $address = $b[$x]->getaccountaddress($_SESSION['btaccount']);
        $file = "cache/" . $address . ".png";
        if (isset($phpqrcode)) {
            include $phpqrcode;
            if (!file_exists($file)) {
                QRCode::png($address, $file);
            }
            echo "<table><tr><td><img id='btimage' src='" . $file . "' alt='QR Code'></td><td>";
        }
        echo "<h3>{$coin_list[$x]}</h3>" . PHP_EOL;
        echo "<div class='infoLine'>" . PHP_EOL;
        echo "   <label>" . $coin_list[$x] . " Network</label>" . PHP_EOL;
        $cBlock = $b[$x]->getblockcount();
        echo "    Blocks: " . $cBlock;
        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Connection:";
        $cons = $b[$x]->getconnectioncount();
        if ($cons >= 9) {
            $cons = 9;
        }
        switch ($cons) {
            case 0: