Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
V
vuejs-skyidentification
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ProjetDemo
vuejs-skyidentification
Commits
d68c19fe
Commit
d68c19fe
authored
Jan 02, 2024
by
dtati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resize image
parent
c4a0c841
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
src/components/HelloWorld.vue
src/components/HelloWorld.vue
+2
-2
src/config/helperConfig.js
src/config/helperConfig.js
+48
-4
No files found.
src/components/HelloWorld.vue
View file @
d68c19fe
...
@@ -23,14 +23,14 @@ export default {
...
@@ -23,14 +23,14 @@ export default {
this
.
readImage
(
selectedFile
);
this
.
readImage
(
selectedFile
);
}
}
},
},
readImage
(
file
)
{
async
readImage
(
file
)
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
const
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
reader
.
onload
=
(
e
)
=>
{
reader
.
onload
=
(
e
)
=>
{
this
.
imagePreview
=
e
.
target
.
result
;
this
.
imagePreview
=
e
.
target
.
result
;
};
};
reader
.
readAsDataURL
(
file
);
reader
.
readAsDataURL
(
file
);
this
.
binaryFile
=
file
;
this
.
binaryFile
=
await
Helper
.
resizeImage
(
file
)
;
this
.
$store
.
dispatch
(
'
skyid_extract_info_from_doc_request
'
,
{
myImage
:
file
,
bearToken
:
this
.
bearToken
}).
then
(()
=>
{
this
.
$store
.
dispatch
(
'
skyid_extract_info_from_doc_request
'
,
{
myImage
:
file
,
bearToken
:
this
.
bearToken
}).
then
(()
=>
{
if
(
this
.
response_ocr
){
if
(
this
.
response_ocr
){
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
...
...
src/config/helperConfig.js
View file @
d68c19fe
...
@@ -5,8 +5,8 @@ export default {
...
@@ -5,8 +5,8 @@ export default {
LIVENESS_url
:
"
***
"
,
LIVENESS_url
:
"
***
"
,
FACE_MATCHING_url
:
"
***
"
,
FACE_MATCHING_url
:
"
***
"
,
skyid_fa_sdk_params_url
:
"
***
"
,
skyid_fa_sdk_params_url
:
"
***
"
,
Recover_Face_Matching_Result_URL
:
"
***
"
,
Recover_Face_Matching_Result_URL
:
"
***
"
,
institution_id
:
"
***
"
,
institution_id
:
"
***
"
,
skyid_fa_sdk_user
:
"
***
"
,
skyid_fa_sdk_user
:
"
***
"
,
skyid_fa_sdk_password
:
"
***
"
,
skyid_fa_sdk_password
:
"
***
"
,
...
@@ -32,6 +32,50 @@ export default {
...
@@ -32,6 +32,50 @@ export default {
bytes
[
i
]
=
binary_string
.
charCodeAt
(
i
);
bytes
[
i
]
=
binary_string
.
charCodeAt
(
i
);
}
}
return
bytes
.
buffer
;
return
bytes
.
buffer
;
},
resizeImage
(
file
)
{
console
.
log
(
file
);
const
defaultQualityRatio
=
0.9
;
const
imageType
=
file
.
type
||
'
image/jpeg
'
;
return
new
Promise
((
resolve
,
reject
)
=>
{
const
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
file
);
reader
.
onload
=
(
e
)
=>
{
const
img
=
new
Image
();
img
.
src
=
e
.
target
.
result
;
img
.
onload
=
()
=>
{
const
canvas
=
document
.
createElement
(
'
canvas
'
);
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
canvas
.
width
=
1000
;
canvas
.
height
=
600
;
if
(
img
.
width
<
img
.
height
)
{
canvas
.
width
=
600
;
canvas
.
height
=
1000
;
}
if
(
img
.
width
>
canvas
.
width
||
img
.
height
>
canvas
.
height
)
{
ctx
.
drawImage
(
img
,
0
,
0
,
canvas
.
width
,
canvas
.
height
);
ctx
.
canvas
.
toBlob
(
(
blob
)
=>
{
resolve
(
new
File
([
blob
],
file
.
name
,
{
type
:
imageType
,
lastModified
:
Date
.
now
(),
})
);
},
imageType
,
defaultQualityRatio
);
}
};
};
reader
.
onerror
=
(
error
)
=>
{
reject
(
error
);};
});
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment