js识别图片二维码解析网址代码
生活随笔
收集整理的這篇文章主要介紹了
js识别图片二维码解析网址代码
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
下載analysis-qrcode.js
<input type="file" id="input"><button id="button">獲取內(nèi)容</button><!--引入js文件--><script src="<?= PublicUtil::URL('@web/js/qrcode/analysis-qrcode.js')?>"></script><script type="text/javascript">//獲取預(yù)覽圖片路徑var getObjectURL = function(file){var url = null ;if (window.createObjectURL!=undefined) { // basicurl = window.createObjectURL(file) ;} else if (window.URL!=undefined) { // mozilla(firefox)url = window.URL.createObjectURL(file) ;} else if (window.webkitURL!=undefined) { // webkit or chromeurl = window.webkitURL.createObjectURL(file) ;}return url ;};$("#button").click(function () {var content = document.getElementById("input").files[0];qrcode.decode(getObjectURL(content));qrcode.callback = function(imgMsg){alert(imgMsg);};});</script>總結(jié)
以上是生活随笔為你收集整理的js识别图片二维码解析网址代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 论文梳理(图像标注)
- 下一篇: 团队开发之:代码规范说明