[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);
});
```