跳至主要內容

TOOLFK tool-online QR code decoding tool

This article recommends [TOOLFK] online QR code decoding, online QR code decoder , you can get the QR code by dragging or uploading the QR code picture, computer camera scanning the QR code, entering the QR code picture address, etc. Content.

Code teaching

The code base that this tool [online QR code decoding tool] depends on is 
https://github.com/davidshimjs/qrcodejs
STEP 1

STEP 2
The core code is as follows
function renderLogo(canvas, url){
    var img = new Image(),
        ctx = canvas.getContext('2d'),
        canvasSize = 200;

    if (!url) {
        ctx.fillStyle = 'rgb(255, 255, 255)';
        ctx.fillRect(0, 0, canvasSize, canvasSize);

        return;
    }

    img.onload = function (){
        var imgSize, zoom,
            imgW = img.width, imgH = img.height;

        canvas.width = canvasSize;
        canvas.height = canvasSize;

        ctx.fillStyle = 'rgb(255, 255, 255)';
        ctx.fillRect(0, 0, canvasSize, canvasSize);

        imgSize = Math.max(imgW, imgH);

        if (imgSize > canvasSize) {
            zoom = canvasSize / imgSize;
            imgW = imgW * zoom;
            imgH = imgH * zoom;
        }

        ctx.drawImage(img, (canvasSize - imgW) / 2, (canvasSize - imgH) / 2, imgW, imgH);
    };

$('#decode-btn').on('click', function (e){
    e.preventDefault();

    $('#decode-text').val("");
    try{
        result = $('#decode-canvas').QRDecode(function (e){
            layer.msg(e.message);
            throw e;
        });
    }catch(err){
        return layer.msg(err.message);
    }
    if (result) {
        $('#decode-text').val(result);
    }
});

留言

此網誌的熱門文章

BASE64-line encryption and decryption, UrlEncode encoding / decoding, native / ascii online conversion tool - toolfk online Programmer toolbox

   This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results. ToolFk also supports    BarCode Barcode generated online  ,   QueryList collector  ,   PHP code is run online  ,   PHP confusion, encryption, decryption  ,   Python code is run online  ,  JavaScript online operation  , YAML formatting tools  ,  HTTP simulation query tool  ,  HTML online toolbox  ,  JavaScript online Toolbox  , CSS online toolbox  ,  JSON online toolbox  ,  unixtime timestamp conversion  ,  Base64 / the URL of / native2ascii conversion  ,  CSV conversion kit  ,  XML online toolbox  ,...

Use PHP CURL simulate HTTP requests for online tool -toolfk online Programmer toolbox

      This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results. ToolFk also supports    BarCode Barcode generated online  ,   QueryList collector  ,   PHP code is run online  ,   PHP confusion, encryption, decryption  ,   Python code is run online  ,  JavaScript online operation  , YAML formatting tools  ,  HTTP simulation query tool  ,  HTML online toolbox  ,  JavaScript online Toolbox  , CSS online toolbox  ,  JSON online toolbox  ,  unixtime timestamp conversion  ,  Base64 / the URL of / native2ascii conversion  ,  CSV conversion kit  ,  XML online toolbox...

PHP to achieve pseudo-original free online tools - toolfk online Programmer toolbox

      This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results. ToolFk also supports    BarCode Barcode generated online  ,   QueryList collector  ,   PHP code is run online  ,   PHP confusion, encryption, decryption  ,   Python code is run online  ,  JavaScript online operation  , YAML formatting tools  ,  HTTP simulation query tool  ,  HTML online toolbox  ,  JavaScript online Toolbox  , CSS online toolbox  ,  JSON online toolbox  ,  unixtime timestamp conversion  ,  Base64 / the URL of / native2ascii conversion  ,  CSV conversion kit  ,  XML online toolbox...