[TOC] ## 开始 下面功能需要引入文件 ``` <script src="../script/upimg.js"></script> ``` ## 集成图片选择加上传 ``` ea55_Multi_image_upload({max:10},function(ret, err,index){ console.log(JSON.stringify(ret)); //{"msg":"操作成功","path":"http://115.28.139.97:8088/download/5f5c26841e0b47209cd314b9","code":200} }); ``` ## 选择图片 ### 集成选择图片 | 参数 |描述 | 类型 |默认值 | 是否可选| | --- | --- |--- | --- | --- | | max | 多选图片时最多选几张 | 数字 | 10 | 可选 | ``` ea55_Select_Picture({max:10},function(ret, err,index){ //主要取值 ret.img_url }); ``` ### 裁剪头像 ``` plugin_FNImageClip_1({ title:"裁剪头像",//标题 imgurl:""//图片url },function(ret){ //{"destPath":"/var/mobile/Containers/Data/Application/9F57D06E-2737-4EE0-9344-FED05CD1F1DB/Documents/uzfs/A6033455046668/imageClip//plugin_FNImageClip_1.png"} console.log(JSON.stringify(ret)); }); ``` ## 上传图片 ### 单独上传图片 ``` ea55_img_upload({file:"图片地址"},function(ret, err){ //{"msg":"操作成功","path":"http://115.28.139.97:8088/download/5f5d80731e0b473efff3255a","code":200} console.log(JSON.stringify(ret)); }); ``` ## 身份证识别 | 参数 |描述 | 类型 |默认值 | 是否可选| | --- | --- |--- | --- | --- | | image | 图像数据,base64编码后进行urlencode,要求base64编码和urlencode后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/jpeg/png/bmp格式 | 字符串 | | | | id_card_side | front:身份证含照片的一面;back:身份证带国徽的一面 | 字符串 | front | 可选 | ``` ea55_baidu_ai_idcard({image:base64,id_card_side:'front',},function(ret, err){ console.log(JSON.stringify(ret)); if(ret&&ret.words_result){ $.each(ret.words_result,function(index,value){ // console.log(index+"..."+value); if(index.indexOf("号码") != -1){ if(value.words){ $("[name='idNumber']").val(value.words); } } if(index.indexOf("姓名") != -1){ if(value.words){ $("[name='driverName']").val(value.words); } } if(index.indexOf("住址") != -1){ if(value.words){ $(".id_address").val(value.words); } } }); } }); ``` ## 图片转base64 ``` ea55_getCanvasBase64({img:'图片路径'}).then(function (base64) { //         console.log("base64》》: ",base64); }, function (err) {    //     console.log(err); }); ```