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
49717aca
Commit
49717aca
authored
Aug 25, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+download as zip
parent
89621f29
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
23 deletions
+102
-23
index.php
src/index/index.php
+15
-15
index.php
src/snapshot/index.php
+59
-3
snapshot.js
src/snapshot/snapshot.js
+28
-5
No files found.
src/index/index.php
View file @
49717aca
...
...
@@ -111,7 +111,7 @@
<br
/>
<a
title=
"autocampars.php"
href=
"autocampars.php"
>
Parameter Editor
</a><br
/>
<a
title=
"camogmgui.php"
href=
"camogmgui.php"
>
Recorder
</a><br
/>
<a
title=
"save snapshots"
href=
"snapshot/"
>
Take s
napshot
</a><br
/>
<a
title=
"save snapshots"
href=
"snapshot/"
>
S
napshot
</a><br
/>
<a
title=
"preview jp4 images (drag and drop from PC)"
href=
"jp4-viewer/?width=1200&quality=1"
>
JP4 Viewer
</a><br
/>
<a
title=
"hwmon.html"
href=
"hwmon.html"
>
Temperature monitor
</a><br
/>
<a
title=
"update NAND flash"
href=
"update_software.html"
>
Update firmware
</a><br
/>
...
...
src/snapshot/index.php
View file @
49717aca
...
...
@@ -43,9 +43,11 @@
}
$lowest_port
=
$available_ports
[
0
]
-
$port0
;
// get TRIG_MASTER from lowest port
if
(
!
empty
(
$available_ports
)){
$trig_master
=
intval
(
elphel_get_P_value
(
$
available_ports
[
0
]
-
$port0
,
ELPHEL_TRIG_MASTER
));
$trig_master
=
intval
(
elphel_get_P_value
(
$
lowest_port
,
ELPHEL_TRIG_MASTER
));
$trig_master_port
=
$trig_master
+
$port0
;
}
...
...
@@ -74,7 +76,7 @@
if
(
isset
(
$_GET
[
'sensor_port'
])){
$port
=
$_GET
[
'sensor_port'
];
}
else
{
$port
=
$
available_ports
[
0
]
-
$port0
;
$port
=
$
lowest_port
;
}
$circbuf_pointers
=
elphel_get_circbuf_pointers
(
$port
,
1
);
...
...
@@ -95,6 +97,55 @@
}
if
(
isset
(
$_GET
[
'zip'
])){
$tmpdir
=
"/tmp/snapshot"
;
// create tmp dir
if
(
!
is_dir
(
$tmpdir
)){
mkdir
(
$tmpdir
);
}
foreach
(
$available_ports
as
$port
){
exec
(
"wget --content-disposition -P
$tmpdir
http://
{
$_SERVER
[
'SERVER_ADDR'
]
}
:
$port
/timestamp_name/bimg"
);
}
$fstring
=
""
;
$zipfile
=
"bimg.zip"
;
$files
=
scandir
(
$tmpdir
);
//remove . & ..
array_splice
(
$files
,
0
,
2
);
$prefixed_files
=
preg_filter
(
'/^/'
,
"
$tmpdir
/"
,
$files
);
$fstring
=
implode
(
" "
,
$prefixed_files
);
// pick name for the zip archive
foreach
(
$files
as
$file
){
$tmp
=
explode
(
"."
,
$file
);
if
(
$tmp
[
1
]
==
"jp4"
||
$tmp
[
1
]
==
"jpeg"
){
$tmp
=
explode
(
"_"
,
$tmp
[
0
]);
if
(
$tmp
[
2
]
==
"0"
){
$zipfile
=
$tmp
[
0
]
.
"_"
.
$tmp
[
1
]
.
".zip"
;
break
;
}
}
}
$zipped_data
=
`zip -qj - $fstring `
;
header
(
'Content-type: application/zip'
);
header
(
'Content-Disposition: attachment; filename="'
.
$zipfile
.
'"'
);
echo
$zipped_data
;
// clean up
foreach
(
$prefixed_files
as
$file
){
unlink
(
$file
);
}
die
();
}
}
?>
...
...
@@ -142,7 +193,7 @@
background-color
:
#A0A0A0
;
/* not Green */
}
#synced
{
#synced
,
#aszip
{
width
:
25px
;
height
:
25px
;
}
...
...
@@ -183,6 +234,11 @@
<br/>
<div>
<table>
<tr>
<td
valign=
'middle'
><span
style=
'font-size:20px;line-height:25px;'
title=
'checked = single zip
unchecked = multiple files'
>
zip
</span></td>
<td
valign=
'middle'
><input
type=
'checkbox'
id=
'aszip'
checked
/></td>
</tr>
<tr>
<td
valign=
'middle'
><span
style=
'font-size:20px;line-height:25px;'
>
sync
</span></td>
<td
valign=
'middle'
><input
type=
'checkbox'
id=
'synced'
checked
/></td>
...
...
src/snapshot/snapshot.js
View file @
49717aca
...
...
@@ -46,12 +46,35 @@ function trigger(){
function
download_all
(
rtp
){
if
(
$
(
"#aszip"
).
prop
(
"checked"
)){
// get ze blob
var
http
=
new
XMLHttpRequest
();
http
.
open
(
"GET"
,
"?zip"
,
true
);
http
.
responseType
=
"blob"
;
http
.
onload
=
function
(
e
){
if
(
this
.
status
===
200
)
{
var
filename
=
this
.
getResponseHeader
(
"Content-Disposition"
);
pass_to_file_reader
(
filename
,
http
.
response
);
if
(
$
(
"#synced"
).
prop
(
"checked"
))
{
read_tp
();
}
}
};
http
.
send
();
}
else
{
DLC
=
0
;
ports
.
forEach
(
function
(
c
,
i
){
//download_single(ip+":"+c+"/timestamp_name/img");
download_single
(
ip
+
":"
+
c
+
"/timestamp_name/bimg"
);
});
}
}
function
download_single
(
addr
){
...
...
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