Loading download.php 0 → 100644 +54 −0 Original line number Diff line number Diff line <?php /* Copyright (C) 2017 Elphel Inc. SPDX-License-Identifier: AGPL-3.0+ https://www.elphel.com */ // https://stackoverflow.com/questions/1061710/php-zip-files-on-the-fly // * solution for ZipArchive worked only from a command line // * solution that worked: command line zip // contstants $TEXTURE_EXTENSIONS = ['png','jpeg','jpg','tif','tiff','gif']; // check if file parameter is specified if (!isset($_GET['file'])) die("-1"); $file = $_GET['file']; $patterns = ['/(\.)+\//','/^\//']; $replacements = ['','']; // check if file exists if (!is_file($file)) die("-2"); if (substr($file,-4)!=".x3d") die("-3"); $pathinfo = pathinfo($file); $path = $pathinfo['dirname']; $tmp = explode("/",$path); $zipfile = $tmp[1]."_".$tmp[2].".zip"; // alright, there's this file $contents = file_get_contents($file); // extract file list preg_match_all('/url="([^\s]+('.implode('|',$TEXTURE_EXTENSIONS).'))"/i',$contents,$matches); // make a string foreach($matches[1] as $v){ $file .= " $path/$v"; } $zipped_data = `zip -qj - $file `; header('Content-type: application/zip'); header('Content-Disposition: attachment; filename="'.$zipfile.'"'); echo $zipped_data; ?> No newline at end of file js/ui.css +13 −21 Original line number Diff line number Diff line Loading @@ -187,10 +187,10 @@ html, body, #x3d_wrapper { height:25px; } #exit_button{ background-image:url('images/ic_exit_to_app_black_48dp_1x.png'); #exit_button,#align_button,#align_tr_button,#download_button{ background-size: 32px 32px; background-repeat: no-repeat; background-position: center; background-color:white; width: 32px; Loading @@ -200,37 +200,29 @@ html, body, #x3d_wrapper { margin-bottom: 2px; } #exit_button{ background-image:url('images/ic_exit_to_app_black_48dp_1x.png'); } #download_button{ background-image:url('images/ic_file_download_black_48dp_1x.png'); background-size: 26px 26px; } #align_button{ background-image:url('images/ic_explore_black_48dp_1x.png'); background-size: 32px 32px; background-repeat: no-repeat; background-color:white; width: 32px; height: 32px; border: 0px solid white; border-radius: 2px; margin-bottom: 2px; } #align_tr_button{ background-image:url('images/ic_horizon_black_48dp_1x.png'); background-size: 32px 32px; background-repeat: no-repeat; background-color:white; width: 32px; height: 32px; border: 0px solid white; border-radius: 2px; margin-bottom: 2px; } #exit_button:hover{ background-color: rgba(240,150,150,1); } #align_button:hover, #align_tr_button:hover{ #align_button:hover, #align_tr_button:hover, #download_button:hover{ /* background-image:url('images/align.png'); */ background-color: rgba(240,240,240,1); } Loading js/ui_menu.js +5 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ Copyright (C) 2017 Elphel Inc. License: GPLv3 SPDX-License-Identifier: GPL-3.0+ https://www.elphel.com Loading Loading @@ -67,6 +67,10 @@ function menu_init(){ window.location.href = origin+path; }); $("#download_button").on("click",function(){ window.location.href = "download.php?file="+SETTINGS.files.x3d; }); // changing a checkbox will not close menu menu.on('click',function(e){ var test = $(e.target).hasClass("donothide"); Loading viewer.html +6 −4 Original line number Diff line number Diff line Loading @@ -55,9 +55,9 @@ <x3d id="x3d_id" width='1600px' height='800px' showProgress="true" showStat="false" showLog="false" disableDoubleClick="true" keysEnabled="true"> <scene> <navigationInfo id="navInfo" type='"examine"' speed='0.01'></navigationInfo> <Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' ></Viewpoint> <!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' ></Viewpoint>--> <!-- in x3dom 1.7.2 - big zNear does not work properly --> <!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' zNear='2'></Viewpoint>--> <Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' zNear='3'></Viewpoint> <!-- <group> <inline name="back" namespacename="back" url="models/m1/v1/background.x3d"/> </group>--> Loading @@ -70,9 +70,10 @@ <div id='crosshair_h' class='crosshair'></div> <div id='crosshair_v' class='crosshair'></div> <div id='help_wrapper'> <div id='menu_button'></div> <div id='help_button'>?</div> <div id='exit_button' title='Exit to models index'></div> <div id='help_button'>?</div> <div id='download_button' title='Download 3d model'></div> <div id='menu_button'></div> <div id='align_button' title='Run alignment algorithm for camera heading and location using markers. Instructions: 1. Use approximate location control on the map to change initial approximation for the algorithm. Loading @@ -83,6 +84,7 @@ Instructions: <!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>--> <div id='align_tr_button' title='Align tilt and roll' class='experimental'></div> </div> <div id='info-wrapper'> <div id='window-info'></div> <div id='window-markinfo'></div> Loading Loading
download.php 0 → 100644 +54 −0 Original line number Diff line number Diff line <?php /* Copyright (C) 2017 Elphel Inc. SPDX-License-Identifier: AGPL-3.0+ https://www.elphel.com */ // https://stackoverflow.com/questions/1061710/php-zip-files-on-the-fly // * solution for ZipArchive worked only from a command line // * solution that worked: command line zip // contstants $TEXTURE_EXTENSIONS = ['png','jpeg','jpg','tif','tiff','gif']; // check if file parameter is specified if (!isset($_GET['file'])) die("-1"); $file = $_GET['file']; $patterns = ['/(\.)+\//','/^\//']; $replacements = ['','']; // check if file exists if (!is_file($file)) die("-2"); if (substr($file,-4)!=".x3d") die("-3"); $pathinfo = pathinfo($file); $path = $pathinfo['dirname']; $tmp = explode("/",$path); $zipfile = $tmp[1]."_".$tmp[2].".zip"; // alright, there's this file $contents = file_get_contents($file); // extract file list preg_match_all('/url="([^\s]+('.implode('|',$TEXTURE_EXTENSIONS).'))"/i',$contents,$matches); // make a string foreach($matches[1] as $v){ $file .= " $path/$v"; } $zipped_data = `zip -qj - $file `; header('Content-type: application/zip'); header('Content-Disposition: attachment; filename="'.$zipfile.'"'); echo $zipped_data; ?> No newline at end of file
js/ui.css +13 −21 Original line number Diff line number Diff line Loading @@ -187,10 +187,10 @@ html, body, #x3d_wrapper { height:25px; } #exit_button{ background-image:url('images/ic_exit_to_app_black_48dp_1x.png'); #exit_button,#align_button,#align_tr_button,#download_button{ background-size: 32px 32px; background-repeat: no-repeat; background-position: center; background-color:white; width: 32px; Loading @@ -200,37 +200,29 @@ html, body, #x3d_wrapper { margin-bottom: 2px; } #exit_button{ background-image:url('images/ic_exit_to_app_black_48dp_1x.png'); } #download_button{ background-image:url('images/ic_file_download_black_48dp_1x.png'); background-size: 26px 26px; } #align_button{ background-image:url('images/ic_explore_black_48dp_1x.png'); background-size: 32px 32px; background-repeat: no-repeat; background-color:white; width: 32px; height: 32px; border: 0px solid white; border-radius: 2px; margin-bottom: 2px; } #align_tr_button{ background-image:url('images/ic_horizon_black_48dp_1x.png'); background-size: 32px 32px; background-repeat: no-repeat; background-color:white; width: 32px; height: 32px; border: 0px solid white; border-radius: 2px; margin-bottom: 2px; } #exit_button:hover{ background-color: rgba(240,150,150,1); } #align_button:hover, #align_tr_button:hover{ #align_button:hover, #align_tr_button:hover, #download_button:hover{ /* background-image:url('images/align.png'); */ background-color: rgba(240,240,240,1); } Loading
js/ui_menu.js +5 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ Copyright (C) 2017 Elphel Inc. License: GPLv3 SPDX-License-Identifier: GPL-3.0+ https://www.elphel.com Loading Loading @@ -67,6 +67,10 @@ function menu_init(){ window.location.href = origin+path; }); $("#download_button").on("click",function(){ window.location.href = "download.php?file="+SETTINGS.files.x3d; }); // changing a checkbox will not close menu menu.on('click',function(e){ var test = $(e.target).hasClass("donothide"); Loading
viewer.html +6 −4 Original line number Diff line number Diff line Loading @@ -55,9 +55,9 @@ <x3d id="x3d_id" width='1600px' height='800px' showProgress="true" showStat="false" showLog="false" disableDoubleClick="true" keysEnabled="true"> <scene> <navigationInfo id="navInfo" type='"examine"' speed='0.01'></navigationInfo> <Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' ></Viewpoint> <!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' ></Viewpoint>--> <!-- in x3dom 1.7.2 - big zNear does not work properly --> <!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' zNear='2'></Viewpoint>--> <Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' zNear='3'></Viewpoint> <!-- <group> <inline name="back" namespacename="back" url="models/m1/v1/background.x3d"/> </group>--> Loading @@ -70,9 +70,10 @@ <div id='crosshair_h' class='crosshair'></div> <div id='crosshair_v' class='crosshair'></div> <div id='help_wrapper'> <div id='menu_button'></div> <div id='help_button'>?</div> <div id='exit_button' title='Exit to models index'></div> <div id='help_button'>?</div> <div id='download_button' title='Download 3d model'></div> <div id='menu_button'></div> <div id='align_button' title='Run alignment algorithm for camera heading and location using markers. Instructions: 1. Use approximate location control on the map to change initial approximation for the algorithm. Loading @@ -83,6 +84,7 @@ Instructions: <!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>--> <div id='align_tr_button' title='Align tilt and roll' class='experimental'></div> </div> <div id='info-wrapper'> <div id='window-info'></div> <div id='window-markinfo'></div> Loading