Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
570dc8b5
Commit
570dc8b5
authored
Jun 13, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes for online viewer
parent
bf1493f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
43 deletions
+58
-43
jquery-jp4.js
src/jp4-canvas/jquery-jp4.js
+58
-43
No files found.
src/jp4-canvas/jquery-jp4.js
View file @
570dc8b5
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
ip
:
""
,
ip
:
""
,
port
:
""
,
port
:
""
,
image
:
"test.jp4"
,
image
:
"test.jp4"
,
fromhtmlinput
:
false
,
refresh
:
false
,
refresh
:
false
,
mosaic
:
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
mosaic
:
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
fast
:
false
,
fast
:
false
,
...
@@ -88,19 +89,29 @@
...
@@ -88,19 +89,29 @@
elem
.
append
(
cnv_working
);
elem
.
append
(
cnv_working
);
elem
.
append
(
cnv_display
);
elem
.
append
(
cnv_display
);
get_image
();
if
(
DEBUG
){
TX
=
Date
.
now
();
T0
=
Date
.
now
();
}
if
(
settings
.
fromhtmlinput
){
/*
* if image is being loaded from <input type='file'>
* make sure the image data starts with: "data:image/jpeg;base64,"
* EXIF.js does not like empty data type: "data:;base64,"
*/
process_image
(
settings
.
image
);
}
else
{
send_request
();
}
//end
//end
function
get_image
(){
function
send_request
(){
var
canvas
=
cnv_working
;
//reset format
IMAGE_FORMAT
=
"JPEG"
;
var
http
=
new
XMLHttpRequest
();
var
rq
=
""
;
var
rq
=
""
;
var
http
=
new
XMLHttpRequest
();
if
(
settings
.
port
!=
""
&&
settings
.
ip
!=
""
){
if
(
settings
.
port
!=
""
&&
settings
.
ip
!=
""
){
rq
=
"get-image.php?ip="
+
settings
.
ip
+
"&port="
+
settings
.
port
+
"&rel=bimg&ts="
+
Date
.
now
();
rq
=
"get-image.php?ip="
+
settings
.
ip
+
"&port="
+
settings
.
port
+
"&rel=bimg&ts="
+
Date
.
now
();
...
@@ -111,12 +122,6 @@
...
@@ -111,12 +122,6 @@
}
}
http
.
open
(
"GET"
,
rq
,
true
);
http
.
open
(
"GET"
,
rq
,
true
);
if
(
DEBUG
){
TX
=
Date
.
now
();
T0
=
Date
.
now
();
}
http
.
responseType
=
"blob"
;
http
.
responseType
=
"blob"
;
http
.
onload
=
function
(
e
)
{
http
.
onload
=
function
(
e
)
{
...
@@ -126,31 +131,45 @@
...
@@ -126,31 +131,45 @@
}
}
if
(
this
.
status
===
200
)
{
if
(
this
.
status
===
200
)
{
var
imgdata
=
URL
.
createObjectURL
(
http
.
response
);
process_image
(
imgdata
);
}
};
http
.
send
();
}
function
process_image
(
imagedata
){
var
canvas
=
cnv_working
;
//reset format
IMAGE_FORMAT
=
"JPEG"
;
var
heavyImage
=
new
Image
();
var
heavyImage
=
new
Image
();
heavyImage
.
onload
=
function
(){
heavyImage
.
onload
=
function
(){
EXIF
.
getData
(
this
,
function
()
{
EXIF
.
getData
(
this
,
function
()
{
var
cnv_w
;
var
cnv_w
;
var
cnv_h
;
var
cnv_h
;
if
(
settings
.
lowres
!=
0
){
if
(
settings
.
lowres
!=
0
){
cnv_w
=
this
.
width
/
settings
.
lowres
;
cnv_w
=
this
.
width
/
settings
.
lowres
;
cnv_h
=
this
.
height
/
settings
.
lowres
;
cnv_h
=
this
.
height
/
settings
.
lowres
;
}
else
{
}
else
{
cnv_w
=
this
.
width
;
cnv_w
=
this
.
width
;
cnv_h
=
this
.
height
;
cnv_h
=
this
.
height
;
}
}
//update canvas size
//update canvas size
canvas
.
attr
(
"width"
,
cnv_w
);
canvas
.
attr
(
"width"
,
cnv_w
);
canvas
.
attr
(
"height"
,
cnv_h
);
canvas
.
attr
(
"height"
,
cnv_h
);
parseEXIFMakerNote
(
this
);
parseEXIFMakerNote
(
this
);
canvas
.
drawImage
({
canvas
.
drawImage
({
x
:
0
,
y
:
0
,
x
:
0
,
y
:
0
,
source
:
this
,
source
:
this
,
width
:
cnv_w
,
width
:
cnv_w
,
...
@@ -163,18 +182,14 @@
...
@@ -163,18 +182,14 @@
sHeight
:
this
.
height
,
sHeight
:
this
.
height
,
//scale: scale,
//scale: scale,
fromCenter
:
false
fromCenter
:
false
});
});
});
});
};
};
heavyImage
.
src
=
URL
.
createObjectURL
(
http
.
response
);
heavyImage
.
src
=
imagedata
;
}
};
http
.
send
();
}
}
function
redraw
(){
function
redraw
(){
//for debugging
//for debugging
...
...
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