Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
reactjs-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
reactjs-skyIdentification
Commits
3dfbb547
Commit
3dfbb547
authored
Dec 28, 2023
by
dtati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rezise_image-1
parent
5558c086
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
src/Components/SkyIdentification.js
src/Components/SkyIdentification.js
+31
-22
No files found.
src/Components/SkyIdentification.js
View file @
3dfbb547
...
...
@@ -19,6 +19,7 @@ const SkyIdentification = () => {
const
readImage
=
(
file
)
=>
{
const
reader
=
new
FileReader
();
//setSelectedFile(file);
resizeImage
(
file
);
reader
.
onload
=
function
()
{
setImageSrc
(
reader
.
result
);
...
...
@@ -71,9 +72,9 @@ const SkyIdentification = () => {
formData
.
append
(
'
institution_id
'
,
helper
.
institution_id
);
formData
.
append
(
'
application_id
'
,
helper
.
skyid_fa_sdk_appId
);
formData
.
append
(
'
channel_id
'
,
"
02
"
);
formData
.
append
(
'
service_id
'
,
"
0
1
"
);
formData
.
append
(
'
service_id
'
,
"
0
9
"
);
formData
.
append
(
'
sub_service_id
'
,
"
005
"
);
formData
.
append
(
"
request_data
"
,
'
{"doc_type":"0
1
"}
'
);
formData
.
append
(
"
request_data
"
,
'
{"doc_type":"0
9
"}
'
);
axios
.
post
(
helper
.
OCR_url
,
formData
,
{
headers
:
{
Authorization
:
`Bearer
${
bearToken
}
`
,
...
...
@@ -159,20 +160,27 @@ const SkyIdentification = () => {
// rezise image function
const
resizeImage
=
(
file
)
=>
{
const
reader
=
new
FileReader
();
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
){
console
.
log
(
"
rezised
"
)
canvas
.
width
=
600
;
canvas
.
height
=
1000
;
}
ctx
.
drawImage
(
img
,
0
,
0
,
canvas
.
width
,
canvas
.
height
);
if
(
img
.
width
>
canvas
.
width
||
img
.
height
>
canvas
.
height
){
console
.
log
(
"
Im here
"
)
ctx
.
drawImage
(
img
,
0
,
0
,
canvas
.
width
,
canvas
.
height
);
canvas
.
toBlob
(
(
blob
)
=>
{
if
(
blob
)
{
...
...
@@ -189,6 +197,7 @@ const SkyIdentification = () => {
file
.
type
,
// Set the image type explicitly
0.9
// Adjust the quality (0.0 to 1.0, 1.0 for maximum quality)
);
}
};
};
...
...
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