Commit 4e88a04b authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

initial

parent 6d05d0ae
<?php
/*!*******************************************************************************
*! FILE NAME : copy_all.php
*! DESCRIPTION : copies all the files to a specified destination
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
$folder = $_GET["src"];
$dest_folder = $_GET["dest"];
$imagej = $_GET["imagej"];
$ext = "jp4";
if (substr($dest_folder,-1,1)!="/") $dest_folder = $dest_folder."/";
if (substr($folder,-1,1)!="/") $folder = $folder."/";
if (substr($imagej,-1,1)!="/") $imagej = $imagej."/";
if (!is_dir($dest_folder)){
$old = umask(0);
@mkdir($dest_folder);
umask($old);
}
if (!is_dir($imagej)){
$old = umask(0);
@mkdir($imagej);
umask($old);
}
$subs = scandir($folder);
foreach($subs as $sub){
if (is_dir($folder.$sub)&&($sub!="trash")) {
exec("cp {$folder}{$sub}/*.$ext {$dest_folder}");
}
}
?>
<?php
/*!*******************************************************************************
*! FILE NAME : exif2kml.php
*! DESCRIPTION : exracts location information into a KML file from images
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
require "pano.inc";
$LEFTFOV = -180;
$RIGHTFOV = +180;
$BOTTOMFOV = -90;
$TOPFOV = +90;
$NEAR = 10000; //meters?
if (isset($_GET['path'])) $path = $_GET['path'];
else if (isset($argv[1])) $path = $argv[1];
if (isset($_GET['ext'])) $ext = $_GET['ext'];
else if (isset($argv[2])) $ext = $argv[2];
if (isset($_GET['dest'])) $some_dir = $_GET['dest'];
else if (isset($argv[3])) $some_dir = $argv[3];
if (isset($_GET['index'])) $some_index = $_GET['index'];
else if (isset($argv[4])) $some_index = $argv[4];
if (isset($_GET['visibility'])) $visibility = $_GET['visibility'];
else if (isset($argv[5])) $visibility = $argv[5];
$directory = $path;
$filename ="../results/for_wpe/map.kml";
echo "directory=$directory\n";
echo "filename= $filename\n";
chdir($directory);
$files=glob("*_1.$ext");
$numNodes=count($files);
echo "nNodes= $numNodes\n";
$world=array();
$i=0;
for ($j=0;$j<$numNodes;$j++) {
if (strpos($files[$j],"_1")) {
//echo strpos($files[$j],"_1")." $i\n";
$world[$i]['href']=$files[$j];
$exif_data = exif_read_data($files[$j]);
$world[$i]['longitude']=(($exif_data['GPSLongitudeRef']=="W")?-1:1)*array2degrees($exif_data['GPSLongitude']);
$world[$i]['latitude']= (($exif_data['GPSLatitudeRef'] =="S")?-1:1)*array2degrees($exif_data['GPSLatitude']);
$world[$i]['altitude']= (($exif_data['GPSAltitudeRef'] =="1")?-1:1)*parseAlt($exif_data['GPSAltitude']);
$world[$i]['DateTimeOriginal']= $exif_data['DateTimeOriginal'];
$world[$i]['SubSecTimeOriginal']= $exif_data['SubSecTimeOriginal'];
if (isset($exif_data['GPSImgDirection'])) {
$world[$i]['heading']= parseAlt($exif_data['GPSImgDirection']); // add correction from magnetic?
$world[$i]['tilt']= (($exif_data['GPSDestLatitudeRef'] =="S")?-1:1)*array2degrees($exif_data['GPSDestLatitude'])+90.0;
if ($world[$i]['tilt']<0) $world[$i]['tilt']==0;
else if ($world[$i]['tilt']>180) $world[$i]['tilt']=180;
$world[$i]['roll']=(($exif_data['GPSDestLongitudeRef']=="W")?-1:1)*array2degrees($exif_data['GPSDestLongitude']);
}
else{
$world[$i]['heading']=0;
$world[$i]['tilt']=90;
$world[$i]['roll']=0;
}
$i++;
}
}
$numNodes = count($world);
// $file=fopen ($filename,'w');
// fwrite($file,generateKML());
// fclose($file);
// works by a couple microseconds slower
file_put_contents($filename,generateKML());
chmod($filename,0666);
function array2degrees($dms) {
$round=1000000;
$d=explode('/',$dms[0]);
$m=explode('/',$dms[1]);
$s=explode('/',$dms[2]);
$rslt= $d[0]/$d[1]+($m[0]/$m[1])/60.0+($s[0]/$s[1])/3600.0;
return round($round*$rslt)/$round;
}
function parseAlt($alt) {
$round=1000000;
$a=explode('/',$alt);
$rslt= $a[0]/$a[1];
return round($round*$rslt)/$round;
}
function generateKML($index=-1) {
global $LEFTFOV;
global $RIGHTFOV;
global $BOTTOMFOV;
global $TOPFOV;
global $NEAR;
global $world, $map, $numNodes;
global $some_dir;
global $some_index;
global $visibility;
if ($index<0) $indices=range(0,$numNodes-1);
else $indices=array_merge(array(0=>$index),$map[$index]);
$kml=<<<HEADER
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
HEADER;
foreach ($indices as $i) {
$dataTime = convert_to_some_time_format($world[$i]['DateTimeOriginal'],$world[$i]['SubSecTimeOriginal']);
$href = modify_href($world[$i]['href']);
$kml.= "<PhotoOverlay>\n";
$kml.= "\t<name>".($i+$some_index)."</name>\n";
$kml.= "\t<visibility>$visibility</visibility>\n";
$kml.= "\t<shape>rectangle</shape>\n";
$kml.= "\t<TimeStamp>\n";
$kml.= "\t\t<when>".$dataTime."</when>\n";
$kml.= "\t</TimeStamp>\n";
$kml.= "\t<Camera>\n";
$kml.= "\t\t<longitude>".$world[$i]['longitude']."</longitude>\n";
$kml.= "\t\t<latitude>".$world[$i]['latitude']."</latitude>\n";
$kml.= "\t\t<altitude>".$world[$i]['altitude']."</altitude>\n";
$kml.= "\t\t<heading>".$world[$i]['heading']."</heading>\n";
$kml.= "\t\t<tilt>".$world[$i]['tilt']."</tilt>\n";
$kml.= "\t\t<roll>".$world[$i]['roll']."</roll>\n";
$kml.= "\t</Camera>\n";
$kml.= "\t<Icon>\n";
$kml.= "\t\t<href>$some_dir/".$href."</href>\n";
$kml.= "\t</Icon>\n";
$kml.= "\t<ExtendedData>\n";
$kml.= "\t\t<OriginalData>\n";
$kml.= "\t\t\t<longitude>".$world[$i]['longitude']."</longitude>\n";
$kml.= "\t\t\t<latitude>".$world[$i]['latitude']."</latitude>\n";
$kml.= "\t\t\t<altitude>".$world[$i]['altitude']."</altitude>\n";
$kml.= "\t\t\t<heading>".$world[$i]['heading']."</heading>\n";
$kml.= "\t\t\t<tilt>".$world[$i]['tilt']."</tilt>\n";
$kml.= "\t\t\t<roll>".$world[$i]['roll']."</roll>\n";
$kml.= "\t\t</OriginalData>\n";
$kml.= "\t</ExtendedData>\n";
$kml.= "</PhotoOverlay>\n";
}
$kml.=<<<TRAILER
</Document>
</kml>
TRAILER;
return ($kml);
}
function convert_to_some_time_format($date,$usec){
$date[4] = "-";
$date[7] = "-";
$date[10] = "T";
$date .= ".{$usec}Z";
return $date;
}
function modify_href($name) {
//$name = substr_replace($name,"",strpos($name,"_1-"),2);
$name = "result_".substr($name,0,-6).".jpeg";
return $name;
}
?>
\ No newline at end of file
<?php
/*!*******************************************************************************
*! FILE NAME : exif2kml_local.php
*! DESCRIPTION : exracts location information into a KML file from images for Panorama Previewer
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
require "pano.inc";
if (isset($_GET['path'])) $path = $_GET['path'];
else if (isset($argv[1])) $path = $argv[1];
else $path = "test";
if (isset($_GET['ext'])) $ext = $_GET['ext'];
else if (isset($argv[2])) $ext = $argv[2];
else $ext = "jp4";
$filename="map_points.kml";
echo "<pre>";
echo "directory=$path\n";
echo "filename= $filename\n";
chdir("/data/footage/$path");
$list = scandir(".");
//ascending sort
asort($list);
$files = array();
foreach ($list as $value) {
//echo $value."\n";
if ($value!="trash") $files = array_merge($files,process_folder($value,"jp4"));
}
$numNodes=count($files);
echo "nNodes= $numNodes\n";
$world=array();
for ($i=0;$i<$numNodes;$i++) {
$world[$i]['href']="http://127.0.0.1/footage/$path/".$files[$i];
print("Reading: ".$files[$i]);
print_r($exif_data_0);
$exif_data = exif_read_data($files[$i]);
print_r($exif_data);
$world[$i]['longitude']=(($exif_data['GPSLongitudeRef']=="W")?-1:1)*array2degrees($exif_data['GPSLongitude']);
$world[$i]['latitude']= (($exif_data['GPSLatitudeRef'] =="S")?-1:1)*array2degrees($exif_data['GPSLatitude']);
$world[$i]['altitude']= (($exif_data['GPSAltitudeRef'] =="1")?-1:1)*parseAlt($exif_data['GPSAltitude']);
if (isset($exif_data['GPSImgDirection'])) {
$world[$i]['heading']= parseAlt($exif_data['GPSImgDirection']); // add correction from magnetic?
$world[$i]['tilt']= (($exif_data['GPSDestLatitudeRef'] =="S")?-1:1)*array2degrees($exif_data['GPSDestLatitude'])+90.0;
if ($world[$i]['tilt']<0) $world[$i]['tilt']==0;
else if ($world[$i]['tilt']>180) $world[$i]['tilt']=180;
$world[$i]['roll']=(($exif_data['GPSDestLongitudeRef']=="W")?-1:1)*array2degrees($exif_data['GPSDestLongitude']);
}else{
$world[$i]['heading']=0;
$world[$i]['tilt']=90;
$world[$i]['roll']=0;
}
}
// $file=fopen ($filename,'w');
// fwrite($file,generateKML());
// fclose($file);
// works by a couple microseconds slower
file_put_contents($filename,generateKML());
chmod($filename,0666);
function array2degrees($dms) {
$round=1000000;
$d=explode('/',$dms[0]);
$m=explode('/',$dms[1]);
$s=explode('/',$dms[2]);
$rslt= $d[0]/$d[1]+($m[0]/$m[1])/60.0+($s[0]/$s[1])/3600.0;
return round($round*$rslt)/$round;
}
function parseAlt($alt) {
$round=1000000;
$a=explode('/',$alt);
$rslt= $a[0]/$a[1];
return round($round*$rslt)/$round;
}
function generateKML($index=-1) {
global $world, $map, $numNodes;
if ($index<0) $indices=range(0,$numNodes-1);
else $indices=array_merge(array(0=>$index),$map[$index]);
$kml=<<<HEADER
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
HEADER;
foreach ($indices as $i) {
$kml.= "<PhotoOverlay>\n";
$kml.= " <Camera>\n";
$kml.=sprintf(" <longitude>%s</longitude>\n",$world[$i]['longitude']);
$kml.=sprintf(" <latitude>%s</latitude>\n",$world[$i]['latitude']);
$kml.=sprintf(" <altitude>%s</altitude>\n",$world[$i]['altitude']);
$kml.=sprintf(" <heading>%s</heading>\n",$world[$i]['heading']);
$kml.=sprintf(" <tilt>%s</tilt>\n",$world[$i]['tilt']);
$kml.=sprintf(" <roll>%s</roll>\n",$world[$i]['roll']);
$kml.= " </Camera>\n";
$kml.= " <Icon>\n";
$kml.=sprintf(" <href>%s</href>\n",$world[$i]['href']);
$kml.= " </Icon>\n";
$kml.= "</PhotoOverlay>\n";
}
$kml.=<<<TRAILER
</Document>
</kml>
TRAILER;
return ($kml);
}
function process_folder($file,$type) {
$arr = array();
$ext=get_file_extension($file);
if (substr($file,0,1)!=".") {
if ($ext=="") {
if (is_dir($file)) {
$arr = glob("$file/*_1.jp4");
}
}
}
return $arr;
}
function get_file_extension($filename) {
//return substr(strrchr($filename, '.'), 1);
return pathinfo($filename, PATHINFO_EXTENSION);
}
?>
\ No newline at end of file
<?php
//echo "<pre>";
//echo update_subsubdir("footage/folder2",0,0);
function check_subdir($path,$subdir){
if (is_dir("$path")) {
if (is_writable("$path")) {
if (is_dir("$path/$subdir")) {
if (is_writable("$path/$subdir"))
return 0;
else
return -2;
}else{
$old = umask(0);
mkdir("$path/$subdir",0777);
umask($old);
if (!is_dir("$path/$subdir")) return -3;
else return 0;
}
}
}else{
return -1;
}
}
function update_subsubdir($path,$index,$limit,$index_max=100000){
if ($index<=$index_max) {
if (!is_dir("$path/$index")) {
// if (!@mkdir("$path/$index",0777)) return -2;
// else return $index;
$old = umask(0);
if (!@mkdir("$path/$index",0777)) return -2;
umask($old);
return $index;
}else{
$files = scandir("$path/$index");
if (count($files)>=$limit+2) return update_subsubdir($path,$index+1,$limit);
else return $index;
}
}else{
return -1;
}
}
function get_free_space($path){
return disk_free_space($path);
}
?>
<?php
/*!*******************************************************************************
*! FILE NAME : filter_jp4s.php
*! DESCRIPTION : filters out incomplete panorama sets from the footage directory
*! REVISION : 1.02
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
//disable the default time limit for php scripts.
set_time_limit(0);
//CONSTANTS
// footage root
$pre_path="/data/footage";
// folder for collecting non-matching results
$dest_path="trash";
//folder
if (isset($_GET['path'])) $processing_folder = $_GET['path'];
else if (isset($argv[1])) $processing_folder = $argv[1];
else $processing_folder = "test";
if (!is_dir("$pre_path/$processing_folder/$dest_path")) {
//creating a folder with access rights - 0777
$old = umask(0);
@mkdir("$pre_path/$processing_folder/$dest_path");
umask($old);
}
$filelist = scandir("$pre_path/$processing_folder");
echo "<pre>\n";
foreach ($filelist as $value) {
//echo $value."\n";
if ($value!=$dest_path) process_folder($value,"jp4");
}
function process_folder($file,$type) {
global $pre_path;
global $processing_folder;
global $dest_path;
$tmp_arr = Array();
$url = "$pre_path/$processing_folder";
$ext=get_file_extension($file);
// exclude "." & ".."
if (substr($file,0,1)!=".") {
if ($ext=="") {
if (is_dir($url."/".$file)) {
//echo $url." ".$file."\n";
if ($type=="") {
// do nothing
}
else {
$list = scandir($url."/".$file);
// getting deeper into indexed subfodlers
foreach($list as $elem){
if (get_file_extension($url."/".$file."/".$elem)==$type) {
//echo $url."/".$file."/".$elem."\n";
// initialize array
if (!isset($tmp_arr[substr($elem,0,17)])) $tmp_arr[substr($elem,0,17)] = 0;
// 9th and 10th images are not part of the panorama
//if (!strstr($elem,"_9.")&&!strstr($elem,"_10."))
$tmp_arr[substr($elem,0,17)]++;
}
}
//do actual copying
print_r($tmp_arr);
foreach($tmp_arr as $key=>$val){
if ($val!=10) {
for ($i=1;$i<11;$i++){
if (is_file("$url/$file/{$key}_$i.$type")) rename("$url/$file/{$key}_$i.$type","$url/$dest_path/{$key}_$i.$type");
}
}
}
}
}
}else{
//do nothing
}
}
}
function get_file_extension($filename) {
//return substr(strrchr($filename, '.'), 1);
return pathinfo($filename, PATHINFO_EXTENSION);
}
?>
\ No newline at end of file
#folders {position:relative;}
#buttons {position:relative;top:20px;left:20px;}
#status {position:relative;top:50px;left:30px;}
#status_span, #blinking_span {font-size:40px;}
.button {
font-size:12px;
color:#fff;
display:inline-block;
border:0px;
text-align:center;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
background:#66aa66;
-moz-box-shadow: 1px 1px 1px black;
-webkit-box-shadow: 1px 1px 1px black;
box-shadow: 1px 1px 1px black;
padding: 5px;
}
.button:hover {
color:#fff;
background:#66bb66;
}
.button:active {
background:#4195dd;
background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#003C82), to(#4195dd));
background:-moz-linear-gradient(0% 90% 90deg, #4195dd, #003C82);
}
.rounded_borders {
border: 0px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
.shadow {
-moz-box-shadow: 2px 2px 2px black;
-webkit-box-shadow: 2px 2px 2px black;
box-shadow: 2px 2px 2px black;
}
.gradient {
/*background: rgba(255,255,255,0.7);*/
background: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.9)), to(rgba(225,225,225,0.6))); /* for webkit browsers */
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(255,255,255,0.6)); /* for firefox 3.6+ */
}
.padding {
padding: 2px 5px 2px 5px;
}
#step1_div {
background: rgba(100,200,100,0.3);
width: 800px;
height: 220px;
padding: 5px;
}
#step2_div {
background: rgba(100,200,100,0.3);
width: 800px;
padding: 5px;
}
#step3_div {
background: rgba(100,200,100,0.3);
width: 800px;
height: 450px;
padding: 5px;
}
#step3_buttons {position:relative;top:20px;left:20px;}
#step3_kml_gen_div {position:relative;top:20px;}
<html>
<head>
<title>Eyesis Footage Procedures</title>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<link rel="some icon" href="fp_logo.png">
<link rel="stylesheet" type="text/css" href="footage_procedures.css" />
</head>
<body>
<div style="padding:5px;font-size:12px;color:red;width:600px;">Note: the folders' rights should be R/W for everyone.</div>
<h4>Step 1: Extracting, creating KML, Previewing, Copying</h4>
<div id=step1_div class="gradient shadow rounded_borders">
<div id=folders>
<table>
<tr>
<td>Processing folder:</td>
<td><b>/data/footage/</b><input class="rounded_borders shadow padding" id="pf" type=text width=300 value='test' /></td>
</tr>
</table>
</div>
<div id=buttons>
<table>
<tr><td style="padding:3px;"><button class=button id=splitall onclick="splitall()">Split All *.movs</button></td></tr>
<tr><td style="padding:3px;"><button class=button id=filter onclick="filter()">Filter Out Images with Non-Matching Timestamps</button></td></tr>
<tr><td style="padding:3px;"><button class=button id=kml_gen onclick="kml_gen()">Generate KML</button></td></tr>
<tr><td style="padding:20px 0px;"><button class=button id=copy_all onclick="copy_all()">Copy All</button>&nbsp;to <b>/data/post-processing/src</b>&nbsp;&nbsp;OR use&nbsp;&nbsp;<a href='../panorama_preview/'>Eyesis Panorama Previewer</a></td></tr>
</table>
</div>
<div style="position:absolute;top:270px;left:750px;">
<button class=button id=step1_run_all onclick="step1_run_all()">Run All</button>
</div>
</div>
<h4>Step 2: Enhancing in ImageJ</h4>
<div id=step2_div class="gradient shadow rounded_borders">
N/A
</div>
<h4>Step 3: Stitching, splitting for WebGL Editor</h4>
<div id=step3_div class="gradient shadow rounded_borders">
<div id=step3_folders>
<table>
<tr>
<td>Processing root folder:</td>
<td><input class="rounded_borders shadow padding" id="s3_pf" type=text style="width:300px" value='/data/post-processing' /></td>
</tr>
<tr>
<td>Sources subfolder:</td>
<td><input class="rounded_borders shadow padding" id="s3_src_sub" type=text width=200 value='src' /></td>
</tr>
<tr>
<td>ImageJ-processed subfolder:</td>
<td><input class="rounded_borders shadow padding" id="s3_processed_sub" type=text width=200 value='imagej_processed' /></td>
</tr>
<tr title="Used when processed tiff from ImageJ is converted into jpeg">
<td>Black Point, %:</td>
<td><input class="rounded_borders shadow padding" type="text" id="s3_bp" value="0" /></td>
</tr>
<tr title="Used when processed tiff from ImageJ is converted into jpeg -> for 32-bit tiff - 25%, for 16-bit - 50%, for 8-bit - 100%">
<td>White Point, %:</td>
<td><input class="rounded_borders shadow padding" type="text" id="s3_wp" value="25" /></td>
</tr>
<tr title="Used when processed tiff from ImageJ is converted into jpeg">
<td>Compression Quality, %:</td>
<td><input class="rounded_borders shadow padding" type="text" id="s3_cq" value="95" /></td>
</tr>
</table>
</div>
<div id=step3_buttons>
<table>
<tr>
<td style="padding:3px;"><button class=button id=step3_stitch onclick="step3_stitch()">Stitch</button></td>
</tr>
<tr><td style="padding:3px;"><button class=button id=Step3_cut onclick="step3_split()">Split images for WebGL Editor</button></td></tr>
<tr><td style="padding:3px;"><button class=button id=step3_compress onclick="step3_compress()">Compress images for Google Earth</button></td></tr>
</table>
</div>
<br/>
<div id=step3_kml_gen_div>
<table>
<tr><td>Path prefix inside KML: </td><td><input class="rounded_borders shadow padding" id="s3_dest" type=text style="width:500px" value='http://127.0.0.1/panoramas' /></td></tr>
<tr><td>Visibility: </td><td><input class="rounded_borders shadow padding" id="s3_visibility" type=text style="width:50px" value='1' /></td></tr>
<tr><td>Staring Index:</td><td><input class="rounded_borders shadow padding" id="s3_index" type=text style="width:50px" value='1' /></td></tr>
</table>
<table style="position:relative;left:20px;">
<tr><td style="padding:3px;"><button class=button id=step3_kml_gen onclick="step3_kml()">Generate KML for WebGL Editor</button></td></tr>
</table>
</div>
<div style="position:absolute;top:765px;left:750px;">
<button class=button id=step1_run_all onclick="step3_run_all()">Run All</button>
</div>
</div>
<div id=status style="width:700px;">Status: <span id=status_span>Idle</span><span id=blinking_span></span></div>
<script>
var working_intvl;
function splitall(){
request = "split_mov_customized.php?ext=jp4&path="+$("#pf").val();
$("#status_span").html("Splitting");
ajax_request(request,"Splitting done.");
}
function filter(){
request = "filter_jp4s.php?ext=jp4&path="+$("#pf").val();
$("#status_span").html("Filtering");
ajax_request_async(request,"Filtering done.");
}
function kml_gen(){
request = "exif2kml_local.php?ext=jp4&path="+$("#pf").val();
$("#status_span").html("Generating KML");
ajax_request_async(request,"KML generated.");
}
function copy_all(){
request = "copy_all.php?src=/data/footage/"+$("#pf").val()+"&dest=/data/post-processing/src"+"&imagej=/data/post-processing/imagej_processed";
$("#status_span").html("Copying");
ajax_request(request,"Copying done.");
}
function step3_stitch(){
request = "stitch.php?dest="+$("#s3_pf").val()+"/results"+"&src="+$("#s3_pf").val()+"/"+$("#s3_processed_sub").val()+"&bp="+$("#s3_bp").val()+"&wp="+$("#s3_wp").val()+"&q="+$("#s3_cq").val();
$("#status_span").html("Stitching");
ajax_request_async(request,"Stitching done.");
}
function step3_split(){
request = "prepare_images_for_wpe.php?path="+$("#s3_pf").val()+"/results";
$("#status_span").html("Splitting for WPE");
ajax_request_async(request,"Splitting for WPE done.");
}
function step3_compress(){
request = "prepare_images_for_google_earth.php?path="+$("#s3_pf").val()+"/results";
$("#status_span").html("Compressing for GE");
ajax_request(request,"Compressing for GE done.");
}
function step3_kml(){
request = "exif2kml.php?ext=jp4&path="+$("#s3_pf").val()+"/"+$("#s3_src_sub").val()+"&visibility="+$("#s3_visibility").val()+"&index="+$("#s3_index").val()+"&dest="+$("#s3_dest").val();
$("#status_span").html("Generating KML");
ajax_request(request,"Generating KML done.");
}
function step1_run_all() {
splitall();
filter();
kml_gen();
}
function step3_run_all() {
step3_stitch();
step3_split();
step3_compress();
step3_kml();
}
function ajax_request(request,done_message){
working_intvl = setInterval("working()",1000);
$.ajax({
url: request,
async: true,
success: function(){
//splitting_done();
procedure_done(done_message);
}
});
}
function ajax_request_async(request,done_message){
working_intvl = setInterval("working()",1000);
$.ajax({
url: request,
async: true,
success: function(){
//splitting_done();
procedure_done(done_message);
}
});
}
function procedure_done(message){
clearInterval(working_intvl);
$("#blinking_span").html("");
$("#status_span").html(message);
}
function working(){
var d = new Date();
var curr_sec = d.getSeconds();
if (curr_sec%4==1) $("#blinking_span").html(".");
else if (curr_sec%4==2) $("#blinking_span").html("..");
else if (curr_sec%4==3) $("#blinking_span").html("...");
else $("#blinking_span").html("");
}
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<?php
$world=array();
$currentNode=-1;
$currentValue="";
$imgOn=false;
$urlPrefix;
function startElement($parser, $name, $attrs)
{
global $world,$currentNode,$currentValue,$imgOn;
switch ($name) {
case 'PhotoOverlay':
$currentNode=count($world);
$world[$currentNode]=array();
break;
case 'Icon':
$imgOn=true;;
break;
}
}
function endElement($parser, $name)
{
global $world,$currentNode,$currentValue,$imgOn,$urlPrefix;
switch ($name) {
case 'longitude':
$world[$currentNode]['longitude']=$currentValue;
break;
case 'latitude':
$world[$currentNode]['latitude']=$currentValue;
break;
case 'altitude':
$world[$currentNode]['altitude']=$currentValue;
break;
case 'heading':
$world[$currentNode]['heading']=$currentValue;
break;
case 'tilt':
$world[$currentNode]['tilt']=$currentValue;
break;
case 'roll':
$world[$currentNode]['roll']=$currentValue;
break;
case 'Icon':
$imgOn=false;
break;
case 'href':
if ($imgOn) $world[$currentNode]['href']=$urlPrefix.$currentValue;
break;
}
}
function characterData($parser, $data)
{
global $currentValue;
$currentValue=$data;
}
// $base - directory, where there is the .kml file, root directory for image files
function parseKML($prefix,$name) {
global $world, $urlPrefix;
$urlPrefix=$prefix;
$xml_parser = xml_parser_create();
// use case-folding so we are sure to find the tag in $map_array
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($name, "r"))) {
die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
return $world;
}
?>
\ No newline at end of file
<?php
/*!*******************************************************************************
*! FILE NAME : prepare_images_for_google_earth.php
*! DESCRIPTION : takes tiff and converts it to a scaled jpeg
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
if (!isset($_GET['path'])) {
printf("No such folder");
exit(-1);
}
// manage a slash in the path string
$path=cut_path_ending_slash($_GET['path']);
if (!is_dir("$path/for_wpe")) {
$old = umask(0);
@mkdir("$path/for_wpe");
umask($old);
}
foreach (scandir($path) as $value) {
process_images($path,$value);
}
function process_images($path,$file) {
global $w,$h;
//resize
$ext=get_file_extension($file);
if ($ext=="tif") {
$basename = basename($file,".tif");
$file = $basename."-0-25-1.jpeg";
exec("convert $path/$file -resize 8192x4096 $path/for_wpe/$basename.jpeg");
//exec("convert $path/$file -resize 2000x1000 -background Black -extent 2000x1000 $path/$basename.jpeg");
}
}
function cut_path_ending_slash($path) {
if (substr($path,-1,1)=="/") $path=substr($path,0,-1);
return $path;
}
function get_file_extension($filename) {
return pathinfo($filename, PATHINFO_EXTENSION);
}
function get_file_basename($filename) {
return substr($filename,0,strpos($filename,"."));
}
?>
\ No newline at end of file
<?php
/*!
*! -----------------------------------------------------------------------------**
*! FILE NAME : prepare_images_for_wpe.php
*! REVISION : 1.0
*! DESCRIPTION: cuts a panorama into 8 squares with 1px overlapping
*! Copyright (C) 2011 Elphel, Inc.
*!
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*!
*! It means that the program's users have the four essential freedoms:
*!
*! * The freedom to run the program, for any purpose (freedom 0).
*! * The freedom to study how the program works, and change it to make it do what you wish (freedom 1).
*! Access to the source code is a precondition for this.
*! * The freedom to redistribute copies so you can help your neighbor (freedom 2).
*! * The freedom to distribute copies of your modified versions to others (freedom 3).
*!
*! By doing this you can give the whole community a chance to benefit from your changes.
*! Access to the source code is a precondition for this.
*! -----------------------------------------------------------------------------**
*/
$w = 14272;
//$h = 4654;
$h = 7135;
if (!isset($_GET['path'])) {
printf("No such folder");
exit(-1);
}
// manage a slash in the path string
$path=cut_path_ending_slash($_GET['path']);
if (!is_dir("$path/for_wpe")) {
$old = umask(0);
@mkdir("$path/for_wpe");
umask($old);
}
foreach (scandir($path) as $value) {
process_images($path,$value);
}
function process_images($path,$file) {
global $w,$h;
//resize
$ext=get_file_extension($file);
if ($ext=="tif") {
$basename = basename($file,".tif");
echo ($w-1)." \n";
//cut the left column:
$file = $basename."-0-25-1.jpeg";
exec("convert $path/$file -crop ".($w-4)."x".$h."-".($w-5)." $path/for_wpe/$file");
exec("convert $path/$file $path/for_wpe/$file +append $path/for_wpe/$file");
exec("convert $path/for_wpe/$file -background Black -extent ".($w-3)."x".($w/2-1)." $path/for_wpe/$file");
for ($j=0;$j<2;$j++) {
for ($i=0;$i<4;$i++) {
$tmp_name = "$path/for_wpe/{$basename}_".($i+$j*4+1)."_8.$ext";
exec("convert $path/for_wpe/$file -crop ".( $w-3)."x".( $w/2-1)."-".((3-$i)*$w/4-(3-$i))."-".((1-$j)*$w/4-(1-$j))." $tmp_name");
exec("convert $tmp_name -crop ".(($i+1)*$w/4-$i)."x".(($j+1)*$w/4-$j)."+".( $i*$w/4-$i)."+".( $j*$w/4-$j)." $tmp_name");
exec("convert $tmp_name $path/for_wpe/{$basename}_".($i+$j*4+1)."_8.jpeg");
exec("rm $path/for_wpe/{$basename}_".($i+$j*4+1)."_8.$ext");
}
}
exec("rm $path/for_wpe/$file");
}
}
function cut_path_ending_slash($path) {
if (substr($path,-1,1)=="/") $path=substr($path,0,-1);
return $path;
}
function get_file_extension($filename) {
return pathinfo($filename, PATHINFO_EXTENSION);
}
function get_file_basename($filename) {
return substr($filename,0,strpos($filename,"."));
}
?>
\ No newline at end of file
#!/usr/local/sbin/php -q
<?php
/*!*******************************************************************************
*! FILE NAME : split_mov.php
*! DESCRIPTION: splits a *.mov file into frames naming them by the timestamp
*! Copyright (C) 2011 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*! $Log: split_mov.php,v $
*!
*/
include 'filesystem.php';
set_time_limit(60*60*24);
$chunksize=10000000; // 10MB
$startMarkerWithExif=chr(hexdec("ff")).chr(hexdec("d8")).chr(hexdec("ff")).chr(hexdec("e1"));
$root_path = "/data/footage";
$starting_index = 0;
echo "<pre>\n";
if (!isset($_GET['path']) || !isset($_GET['ext'])) {
echo "Usage split_mov.php?path=&lt;path_of_the_mov_file&gt;&ext=&lt;extension&gt;";
//echo "Usage split_mov.php?path=path_of_the_mov_file&ext=extension";
echo "</pre>\n";
exit (1);
}
if (isset($_GET['path'])) $path=$_GET['path'];
else $path="20110413/mov";
if (isset($_GET['ext'])) $extension = $_GET['ext'];
else $extension = "jp4";
$n = count(scandir("$root_path/$path/mov"))-2;
for($i=0;$i<$n;$i++){
$mov_files = scandir("$root_path/$path/mov/".($i+1));
foreach($mov_files as $mov_file) {
$ext = get_file_extension($mov_file);
if ($ext=="mov") {
echo $mov_file."\n";
$index=update_subsubdir("$root_path/$path",$starting_index,$limit=90000);
//$channel=get_channel($mov_file);
//echo "$channel\n";
split_mov("$root_path/$path","mov/".($i+1)."/".$mov_file,"$index",$i+1,"jp4",$startMarkerWithExif,$chunksize);
}
}
}
//$mov_files = scandir("$root_path/$path/mov/1");
// foreach($mov_files as $mov_file) {
// $ext = get_file_extension($mov_file);
// if ($ext=="mov") {
// echo $mov_file."\n";
// $index=update_subsubdir("$root_path/$path",$starting_index,$limit=90000);
//
// //$channel=get_channel($mov_file);
// //echo "$channel\n";
// for ($channel=1;$channel<10;$channel++){
// split_mov("$root_path/$path","mov/$channel/".$mov_file,"$index",$channel,"jp4",$startMarkerWithExif,$chunksize);
// }
// }
// }
function get_channel($string){
$end = strrpos($string,".");
$start = strrpos($string,"_")+1;
return substr($string,$start,$end-$start);
}
function split_mov($path,$mov_file,$dest,$channel,$ext,$startMarkerWithExif,$chunksize) {
$path_with_name = "$path/$mov_file";
if (!is_file($path_with_name)) {
return -1;
}
$file=fopen($path_with_name,'r');
$markers=array(0);
$offset=0;
while (!feof($file)) {
fseek($file,$offset);
$s = fread($file,$chunksize);
$index=0;
$pos=0;
while (true) {
$pos=strpos($s,$startMarkerWithExif,$pos);
if ($pos === false) break;
$markers[count($markers)]=$offset+$pos;
$pos++;
}
$offset+=(strlen($s)-strlen($startMarkerWithExif)+1); // so each marker will appear once
}
$markers[count($markers)]=$offset+strlen($s); // full length of the file
for ($i=1;$i<(count($markers)-1);$i++) {
fseek($file,$markers[$i]);
$s = fread($file,$markers[$i+1]-$markers[$i]);
$old_file_name= "$path/tmp.".$ext;
$outFile=fopen($old_file_name,'w');
fwrite($outFile,$s);
fclose($outFile);
//read exif & rename
$exif_data = exif_read_data($old_file_name);
//converting GMT a local time GMT+7
$DateTimeOriginal_local=strtotime($exif_data['DateTimeOriginal']);/*-25200;*/
$new_file_name = $DateTimeOriginal_local."_".$exif_data['SubSecTimeOriginal']."_$channel.".$ext;
rename($old_file_name,"$path/$dest/$new_file_name");
}
return 0;
}
function get_file_extension($filename) {
return pathinfo($filename, PATHINFO_EXTENSION);
}
?>
\ No newline at end of file
<?php
/*!*******************************************************************************
*! FILE NAME : stitch.php
*! DESCRIPTION : launches enblend for imagej processed images
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! The four essential freedoms with GNU GPL software:
*! * the freedom to run the program for any purpose
*! * the freedom to study how the program works and change it to make it do what you wish
*! * the freedom to redistribute copies so you can help your neighbor
*! * the freedom to distribute copies of your modified versions to others
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
if (isset($_GET['src'])) $src = $_GET['src'];
else if (isset($argv[1])) $src = $argv[1];
else {print_script_contents();}
if (isset($_GET['dest'])) $dest = $_GET['dest'];
else if (isset($argv[2])) $dest = $argv[2];
else {print_script_contents();}
if (isset($_GET['bp'])) $black_point = $_GET['bp'];
else if (isset($argv[3])) $black_point = $argv[3];
else $black_point = 0;
if (isset($_GET['wp'])) $white_point = $_GET['wp'];
else if (isset($argv[4])) $white_point = $argv[4];
else $white_point = 25;
if (isset($_GET['q'])) $quality = $_GET['q'];
else if (isset($argv[5])) $quality = $argv[5];
else $quality = 92;
if (!is_dir($dest)) {
//creating a folder with access rights - 0777
$old = umask(0);
@mkdir($dest);
umask($old);
}
$files = scandir($src);
$timestamps = Array();
$suffs = Array();
//print_r($files);
$f = Array();
foreach($files as $file){
if (get_file_extension($file)=="tiff") update($file);
}
//print_r($timestamps);
foreach($timestamps as $index=>$tss) {
$list1 = "";
$list2 = "";
$list3 = "";
$f=update_fs($suffs[$index]);
for ($i=0;$i<9;$i++) if (is_file("$src/{$tss}-".$f[$i])) $list1 .= " $src/{$tss}-".$f[$i];
for ($i=9;$i<18;$i++) if (is_file("$src/{$tss}-".$f[$i])) $list2 .= " $src/{$tss}-".$f[$i];
for ($i=18;$i<27;$i++) if (is_file("$src/{$tss}-".$f[$i])) $list3 .= " $src/{$tss}-".$f[$i];
//echo "dam {$suffs[$index]}\n";
//exec("enblend -l 10 --no-optimize --fine-mask -a -v -w -o $dest/result_{$tss}_1.tif $list");
//exec("enblend --fine-mask -a -v -w -o $dest/result_{$tss}_top.tif $list1");
//exec("enblend --fine-mask -a -v -w -o $dest/result_{$tss}_mid.tif $list2");
//exec("enblend --fine-mask -a -v -w -o $dest/result_{$tss}_bot.tif $list3");
exec("enblend-mp --fine-mask -a -v -w -o $dest/result_{$tss}_top.tif $list1");
exec("enblend-mp --fine-mask -a -v -w -o $dest/result_{$tss}_mid.tif $list2");
exec("enblend-mp --fine-mask -a -v -w -o $dest/result_{$tss}_bot.tif $list3");
exec("enblend-mp --fine-mask -a --wrap='vertical' -o $dest/result_{$tss}.tif $dest/result_{$tss}_top.tif $dest/result_{$tss}_mid.tif $dest/result_{$tss}_bot.tif");
unlink("$dest/result_{$tss}_top.tif");
unlink("$dest/result_{$tss}_mid.tif");
unlink("$dest/result_{$tss}_bot.tif");
//exec("convert $dest/result_{$tss}.tif -level 0%,10%,1 $dest/result_{$tss}-0-10-1.jpeg");
//exec("convert $dest/result_{$tss}.tif -level 0%,14%,1 $dest/result_{$tss}-0-14-1.jpeg");
//exec("convert $dest/result_{$tss}.tif -level 0%,18%,1 $dest/result_{$tss}-0-18-1.jpeg");
exec("convert $dest/result_{$tss}.tif -level {$black_point}%,{$white_point}%,1 -quality $quality $dest/result_{$tss}-0-25-1.jpeg");
//exec("convert $dest/result_{$tss}.tif -level 0%,50%,1 $dest/result_{$tss}-0-50-1.jpeg");
}
function update($file){
global $timestamps;
global $suffs;
$found = false;
$ts = substr($file,0,17);
$mid = "RGB24";
if (preg_match("/INT16/",$file)!=0) $mid = "INT16";
$suf = "DECONV";//default
if (preg_match("/DECONV/",$file)!=0) $suf = "DECONV-{$mid}_EQR";
if (preg_match("/DEMOSAIC/",$file)!=0) $suf = "DEMOSAIC-{$mid}_EQR";
if (preg_match("/LOWRES/",$file)!=0) $suf = "LOWRES-{$mid}_EQR";
foreach($timestamps as $index=>$elem) {
if ($ts==$elem) {
if ($suffs[$index]==$suf) {
$found = true;
}
}
}
if (!$found) {
$timestamps[count($timestamps)] = $ts;
$suffs[count($suffs)] = $suf;
}
}
function get_file_extension($filename) {
return pathinfo($filename, PATHINFO_EXTENSION);
}
function update_fs($suff){
$f = Array();
$f[0] = "12-$suff-RIGHT.tiff";
$f[1] = "13-$suff.tiff";
$f[2] = "14-$suff.tiff";
$f[3] = "15-$suff.tiff";
$f[4] = "08-$suff.tiff";
$f[5] = "09-$suff.tiff";
$f[6] = "10-$suff.tiff";
$f[7] = "11-$suff.tiff";
$f[8] = "12-$suff-LEFT.tiff";
$f[9] = "04-$suff-RIGHT.tiff";
$f[10] = "05-$suff.tiff";
$f[11] = "06-$suff.tiff";
$f[12] = "07-$suff.tiff";
$f[13] = "00-$suff.tiff";
$f[14] = "01-$suff.tiff";
$f[15] = "02-$suff.tiff";
$f[16] = "03-$suff.tiff";
$f[17] = "04-$suff-LEFT.tiff";
$f[18] = "20-$suff-RIGHT.tiff";
$f[19] = "21-$suff.tiff";
$f[20] = "22-$suff.tiff";
$f[21] = "23-$suff.tiff";
$f[22] = "16-$suff.tiff";
$f[23] = "17-$suff.tiff";
$f[24] = "18-$suff.tiff";
$f[25] = "19-$suff.tiff";
$f[26] = "20-$suff-LEFT.tiff";
return $f;
}
function print_script_contents(){
$fp = fopen($_SERVER['SCRIPT_FILENAME'], 'rb');
fseek($fp, 0, SEEK_END); /// file pointer at the end of the file (to find the file size)
$fsize = ftell($fp); /// get file size
fseek($fp, 0, SEEK_SET); /// rewind to the start of the file
/// send the headers
header("Content-Type: application/x-php");
header("Content-Length: ".$fsize."\n");
fpassthru($fp); /// send the script (this file) itself
fclose($fp);
die("0");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment