openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

qrcode.php (1192B)


      1 <?php
      2 require('util/qrcode/qrlib.php');
      3 
      4 
      5 $value = urldecode($_GET['value']);
      6 
      7 // outputs image directly into browser, as PNG stream
      8 
      9 switch( $_GET['type'] )
     10 {
     11     case 'text':
     12         ?>
     13 <html lang="de">
     14 <head>
     15 <title>Test</title>
     16 <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
     17 <meta name="viewport" content="width=device-width, initial-scale=1" />
     18 </head>
     19 <body style="color:gray; background-color:brown;"><hr>TEXT:
     20         <pre style="line-height:14px; font-size:14px;">
     21         QR-Code:<br/><?php
     22         $bytes = QRcode::text($value);
     23         $out = strtr( join("<br/>",$bytes ),array(
     24           '0' => '&nbsp;',
     25           '1' => '&#9608;' ));
     26         echo $out;
     27 ?>
     28 </pre>
     29 Länge: <?php echo strlen($out)?> bytes, raw: <?php echo strlen(join("",$bytes)) ?> bytes
     30 
     31 <hr>
     32 PNG:
     33 
     34 <img src="./qrcode.php?type=png&value=<?php echo $value ?>" />
     35 <hr>
     36 SVG:
     37 <img src="./qrcode.php?type=svg&value=<?php echo $value ?>" />
     38 
     39 </body></html><?php 
     40         break;
     41     case 'svg':
     42         echo  QRcode::svg($value,false,QR_ECLEVEL_L,3,4,false,0xFF0000,0xBBBBBB);
     43         break;
     44     default: 
     45        
     46         QRcode::png($value,false,QR_ECLEVEL_L,3,4,false,0xFF0000,0xBBBBBB);
     47 }
     48 
     49 ?>