123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <html>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <head>
- <title>QuickSend RX</title>
- <link rel="stylesheet" href="tocas.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
- <script type="text/javascript" src="js/grid.js"></script>
- <script type="text/javascript" src="js/version.js"></script>
- <script type="text/javascript" src="js/detector.js"></script>
- <script type="text/javascript" src="js/formatinf.js"></script>
- <script type="text/javascript" src="js/errorlevel.js"></script>
- <script type="text/javascript" src="js/bitmat.js"></script>
- <script type="text/javascript" src="js/datablock.js"></script>
- <script type="text/javascript" src="js/bmparser.js"></script>
- <script type="text/javascript" src="js/datamask.js"></script>
- <script type="text/javascript" src="js/rsdecoder.js"></script>
- <script type="text/javascript" src="js/gf256poly.js"></script>
- <script type="text/javascript" src="js/gf256.js"></script>
- <script type="text/javascript" src="js/decoder.js"></script>
- <script type="text/javascript" src="js/qrcode.js"></script>
- <script type="text/javascript" src="js/findpat.js"></script>
- <script type="text/javascript" src="js/alignpat.js"></script>
- <script type="text/javascript" src="js/databr.js"></script>
- <script type="text/javascript">
- function qdecode(){
- var result = qrcode.decode();
- if (result.includes("imuslab.com")){
- window.location.replace(result);
- }else{
- alert(result);
- }
- }
- </script>
- </head>
- <body>
- <div class="ts inverted heading fluid slate" style="background-color:#2c2835;color:white;">
- <span class="large header">Quick Send System</span>
- <span class="description">Send data between mobile and laptops.<br> Powered by IMUS Laboratory</span>
- <div class="ts bottom attached tabbed menu" style="color:white;">
- <a class="item" href="index.php" style="color:#9d9ca3;">Send</a>
- <a class="active item" href="rx.php">Receive</a>
- <a class="item" href="img.php" style="color:#9d9ca3;">Image</a>
- <a class="item" href="file.php" style="color:#9d9ca3;">Files</a>
- </div>
- </div>
- <div class="ts container">
- <br><br>
- <div class="ts stackable grid">
- <div class="four wide column" align="center">
- <h4>QuickSend ID</h4>
- <div class="ts fluid input">
- <input type="text" id="mid" placeholder="Memo ID" style="width:100%;">
- </div>
- <button id="viewbtn"class="ts basic fluid button" onclick="manual_redirect();" >View</button>
- <div class="ts tiny statistic" onClick="cloneCode();">
- <div class="label">Latest QSCode Number</div>
- <div class="value" id="lcode"><?php
- $max = 0;
- foreach (new DirectoryIterator('Memo/') as $fileInfo) {
- if ($fileInfo->isDot()) continue;
- $current = pathinfo($fileInfo->getFilename())['filename'];
- if (!is_numeric($current)) continue;
- if ($current > $max) $max = $current;
- }
- echo $max;
- ?></div>
- </div>
-
- </div>
- <div class="twelve wide column">
- <h4>QR-Code ID</h4>
- <form>
- <div>
- <input class="ts button" type="file" accept="image/*" id="file-input" capture="camera">
- </div>
- </form>
- <canvas id="qr-canvas" width="256px" height="256px" style="display:none;"></canvas>
- <canvas id="preview-canvas" width="256px" height="256px"></canvas>
- <div class="ts container" align="right">
- <button class="ts basic button" onclick="qdecode()">Decode</button>
- </div>
- </div>
- </div>
- <br><br><br><br><br><br>
- <div style="position: fixed;
- z-index: 100;
- bottom: 0;
- left: 0;
- width: 100%;
- background-color:#2c2835;
- color:white;">
- <div class="ts container">
- <img class="ts tiny right floated image" src="img/cube.png"></img>
- </div>
- <div align="left" class="ts container">
- <br>
- CopyRight IMUS Laboratory 2018, All right reserved.
- </div>
- </div>
- </div>
- <script>
- $("#viewbtn").keyup(function(event) {
- if (event.keyCode == 13) {
- manual_redirect();
- }
- });
- function resizeCanvasImage(img, canvas, maxWidth, maxHeight) {
- var imgWidth = img.width,
- imgHeight = img.height;
- var ratio = 1, ratio1 = 1, ratio2 = 1;
- ratio1 = maxWidth / imgWidth;
- ratio2 = maxHeight / imgHeight;
- // Use the smallest ratio that the image best fit into the maxWidth x maxHeight box.
- if (ratio1 < ratio2) {
- ratio = ratio1;
- }
- else {
- ratio = ratio2;
- }
- var canvasContext = canvas.getContext("2d");
- var canvasCopy = document.createElement("canvas");
- var copyContext = canvasCopy.getContext("2d");
- var canvasCopy2 = document.createElement("canvas");
- var copyContext2 = canvasCopy2.getContext("2d");
- canvasCopy.width = imgWidth;
- canvasCopy.height = imgHeight;
- copyContext.drawImage(img, 0, 0);
- // init
- canvasCopy2.width = imgWidth;
- canvasCopy2.height = imgHeight;
- copyContext2.drawImage(canvasCopy, 0, 0, canvasCopy.width, canvasCopy.height, 0, 0, canvasCopy2.width, canvasCopy2.height);
- var rounds = 2;
- var roundRatio = ratio * rounds;
- for (var i = 1; i <= rounds; i++) {
- console.log("Step: "+i);
- // tmp
- canvasCopy.width = imgWidth * roundRatio / i;
- canvasCopy.height = imgHeight * roundRatio / i;
- copyContext.drawImage(canvasCopy2, 0, 0, canvasCopy2.width, canvasCopy2.height, 0, 0, canvasCopy.width, canvasCopy.height);
- // copy back
- canvasCopy2.width = imgWidth * roundRatio / i;
- canvasCopy2.height = imgHeight * roundRatio / i;
- copyContext2.drawImage(canvasCopy, 0, 0, canvasCopy.width, canvasCopy.height, 0, 0, canvasCopy2.width, canvasCopy2.height);
- } // end for
- // copy back to canvas
- canvas.width = imgWidth * roundRatio / rounds;
- canvas.height = imgHeight * roundRatio / rounds;
- canvasContext.drawImage(canvasCopy2, 0, 0, canvasCopy2.width, canvasCopy2.height, 0, 0, canvas.width, canvas.height);
- }
- $(function() {
- $('#file-input').change(function(e) {
- var file = e.target.files[0],
- imageType = /image.*/;
- if (!file.type.match(imageType))
- return;
- var reader = new FileReader();
- reader.onload = fileOnload;
- reader.readAsDataURL(file);
- });
- function fileOnload(e) {
- var $img = $('<img>', { src: e.target.result });
- $img.load(function() {
- var canvas = $('#qr-canvas')[0];
- var context = canvas.getContext('2d');
- canvas.width = this.naturalWidth;
- canvas.height = this.naturalHeight;
- context.drawImage(this, 0, 0);
- //grab the context from your destination canvas
- var pcanvas = $('#preview-canvas')[0];
- var destCtx = pcanvas.getContext('2d');
- //call its drawImage() function passing it the source canvas directly
- destCtx.drawImage(canvas, 0, 0, 256, 256 * this.height / this.width);
- });
- }
- });
- function manual_redirect(){
- var id = $("#mid").val();
- window.location.replace("http://imuslab.com/qs/display.php?id=" + id);
- }
- function cloneCode(){
- $("#mid").val($("#lcode").html());
- }
- </script>
- </body>
- </html>
|