星空网 > 软件开发 > ASP.net

Atitit.二维码功能的设计实践 attilax 总结

 

 

 

Atitit.二维码功能的设计实践 attilax 总结

 

 

1.1. 二维码要实现的功能1

1.2. 现有二维码功能设计不足的地方(待改进)1

1.3. 二维码组件1

1.4. Java版  zxing类库..2

1.5. Php版 laveral框架版3

1.6. Phpqrcode框架版3

1.7. Qa集合与注意事项3

 

1.1. 二维码要实现的功能

显示二维码

保持二维码图片为文件

直接输出二维码图片流

Img 的src为二维码图片

一般要传递order_id 或者一个url参数为主。

 

 

 

 

1.2. 现有二维码功能设计不足的地方(待改进)

Java 与php的api 统一化

增加Js sdk

 

 

1.3. 二维码组件

Prj eform

<a href="{{ url('/qrcodeQ5/qrcode.php?url='.base64_encode($url)) }}">

      <img src='/images/loading.gif' data-original="{{ url('/qrcodeQ5/qrcode.php?url='.base64_encode($url)) }}" >

    </a>

 

作者::  ★(attilax)>>>   绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

 

1.4. Java版  zxing类库..

 

#-----com.xx.share.sharex.java

public   String gene(String code) {
        String qrcodedir = "qrcodeO5/"+filex.getUUidName()+".jpg";
    
        String path=pathx.webAppPath() + "/" + qrcodedir;
        filex.createAllPath(path);
        core.log("--qrcode path:"+path);
    // attilax 老哇的爪子  下午5:30:42   2014年5月11日 
      qrcodex.    gene(code, path, 250, 250);
      return qrcodedir;
    }

 

#----com.attilax.qrcode.qrcodex.javar


public static void gene(final String content, final String path,
            final int width, final int height) {
        new tryX<Object>() {

            @Override
            public Object item(Object t) throws Exception {
                // attilax 老哇的爪子  下午5:23:26   2014年5月11日 
                   MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
                     
                     Map hints = new HashMap();
                     hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
                 
                    BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, width, height,hints);
                     File file1 = new File(path );
                     MatrixToImageWriter.writeToFile(bitMatrix, "jpg", file1);
                return null;
            }
        }.$("");
    }    
    

 

1.5. Php版 laveral框架版

    ob_clean();//清除输出

 $image=QrCode::format('png')->merge('/public/'.CDN_IMG.'logo.png', .3)->margin(2)->size(200)->color(0,0,0)->backgroundColor(255,255,255)->encoding('UTF-8')->generate($url);

return response()->make($image, 200, [

            'content-type' => 'image/png',

        ]);

1.6. Phpqrcode框架版

 

<?php

$url=base64_decode($_GET["url"]);

include 'phpqrcode/phpqrcode.php';

//QRcodeQ5::png('code data text', 'filename.png'); // creates file

QRcodeQ5::png($url);

 

//QRcodeQ5::png('some othertext 1234'); // creates code image and outputs it directly into browser

//输出图片   

//imagepng($QR, 'helloweixin.png');   

?>

 

 

1.7. Qa集合与注意事项

输出png的图片不能正常显示,这个通常是bom头造成的,某一个类库php是utf8格式的,而生成qrcode的php界面include了它。。。最简单的解决方案是

先用   ob_clean();//清除输出,一般就可,但在laveral框架下,任然不可。。

就把生成qrcode的php组件独立出来,然后通过img的src调用。。即可。。

 

参考

atitit.二维码生成总结java zxing - attilax的专栏 - 博客频道 - CSDN.NET.html

 




原标题:Atitit.二维码功能的设计实践 attilax 总结

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

苍南专线:https://www.goluckyvip.com/tag/97873.html
东莞云南专线物流:https://www.goluckyvip.com/tag/97874.html
日照专线:https://www.goluckyvip.com/tag/97875.html
东城专线:https://www.goluckyvip.com/tag/97876.html
东莞 专线:https://www.goluckyvip.com/tag/97877.html
广州南通专线:https://www.goluckyvip.com/tag/97878.html
重庆品胜科技与星苹台达成合作 助力部队现代化后勤建设 :https://www.kjdsnews.com/a/1836523.html
回乡创业,不知道干什么,能否推荐几个农村老家创业的好项目?:https://www.vstour.cn/a/365177.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流