1
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"x_ocr_s": "./lib/x_ocr_s.har"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { x_ocrDecode } from "x_ocr_s"
|
||||
|
||||
export function chooseImageBuilder(callback : (str : string[], source : string[]) => void, langs : string | null) {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success(evt : ChooseImageSuccess) {
|
||||
uni.showLoading({ title: '', mask: true })
|
||||
if (evt.tempFilePaths.length > 0) {
|
||||
const imgs = UTSHarmony.convert2AbsFullPath(evt.tempFilePaths[0] as string);
|
||||
x_ocrDecode(imgs, (arg1 : string[], arg2 : string[]) => {
|
||||
callback(arg1, arg2)
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
callback([] as string[], [] as string[])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function downloadUrlImageBuilder(url : string,callback:(str:string[],source:string[])=>void,langs:string|null) {
|
||||
uni.downloadFile({
|
||||
url,
|
||||
success(evt) {
|
||||
x_ocrDecode(UTSHarmony.convert2AbsFullPath(evt.tempFilePath), callback)
|
||||
},
|
||||
fail() {
|
||||
callback([] as string[],[] as string[])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function localFilePathImageBuilder(pathfile : string,callback:(str:string[],source:string[])=>void,langs:string|null){
|
||||
x_ocrDecode(UTSHarmony.convert2AbsFullPath(pathfile), callback)
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user