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
Hide 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
...
...
@@ -27,12 +27,12 @@
<meta
charset=
"utf-8"
/>
<script>
// for LibreJS:
/**
/**
* @file index.php
* @copyright Copyright (C) 2017 Elphel Inc.
* @author -
*
* @licstart The following is the entire license notice for the
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* The JavaScript code in this page is free software: you can
...
...
@@ -62,8 +62,8 @@
}
.img_window
{
border
:
1px
solid
rgba
(
210
,
210
,
210
,
1
);
}
}
table
td
{
padding-right
:
10px
;
}
...
...
@@ -72,13 +72,13 @@
<body>
<div
style=
'padding:10px'
>
<?php
$port0
=
2323
;
$path
=
"/sys/devices/soc0/elphel393-detect_sensors@0"
;
$table_contents
=
""
;
$port_links
=
""
;
for
(
$i
=
0
;
$i
<
4
;
$i
++
){
$sensor
=
$path
.
"/sensor
{
$i
}
0"
;
if
(
is_file
(
$sensor
)){
...
...
@@ -87,31 +87,31 @@
$sandp
=
"http://
{
$_SERVER
[
"SERVER_ADDR"
]
}
:"
.
(
$port0
+
$i
);
$href1
=
"
$sandp
/bimg"
;
$href2
=
"
$sandp
/mimg"
;
$table_contents
.=
"<td>"
;
$table_contents
.=
"<div class='port_window img_window'>"
;
$table_contents
.=
"<div><a href=
\"
$href1
\"
><img class='img_window' src='
$href1
' style='width:300px'/></a></div>"
;
$table_contents
.=
"<div style='text-align:center;'>port
$i
: <a title='single image' href='
$href1
'>bimg</a>, <a title='multi-part image stream (M-JPEG)' href='
$href2
'>mimg</a></div>"
;
$table_contents
.=
"</div>"
;
$table_contents
.=
"</td>"
;
$port_links
.=
"<li><a href=
\"
#
\"
onclick=
\"
window.open('camvc.html?sensor_port=
$i
&reload=0', 'port 0','menubar=0, width=800, height=600, toolbar=0, location=0, personalbar=0, status=0, scrollbars=1')
\"
>port
$i
</a></li>
\n
"
;
}
}
}
echo
"<table><tr>
$table_contents
</tr></table>
\n
"
;
echo
"<br/>"
;
echo
"Camera Control Interface<ul>
$port_links
</ul>
\n
"
;
?>
<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,11 +46,34 @@ function trigger(){
function
download_all
(
rtp
){
DLC
=
0
;
ports
.
forEach
(
function
(
c
,
i
){
//download_single(ip+":"+c+"/timestamp_name/img");
download_single
(
ip
+
":"
+
c
+
"/timestamp_name/bimg"
);
});
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"
);
});
}
}
...
...
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