1
|
<?php
|
2
|
if (isset($_GET['name'])) {
|
3
|
|
4
|
$pano_name = htmlspecialchars($_GET['name']);
|
5
|
$filePartArr = explode('.',$pano_name);
|
6
|
$ext = $filePartArr[count($filePartArr) - 1];
|
7
|
if($ext=="tif"){
|
8
|
$pano_basename = basename($pano_name,".tif");
|
9
|
}else if($ext=="jpeg"){
|
10
|
$pano_basename = basename($pano_name,".jpeg");
|
11
|
} else {
|
12
|
$pano_basename = basename($pano_name,".jpg");
|
13
|
}
|
14
|
|
15
|
|
16
|
$input = './to_tiles/gen_tiles.sh -p '.$pano_basename.' /var/www/data/tsf2/vpongnian/panorama/upload/'.$pano_name;
|
17
|
$escaped_command = escapeshellcmd($input);
|
18
|
$output = shell_exec($escaped_command);
|
19
|
$log_file = fopen('./log/'.$pano_basename.'.log','a+');
|
20
|
fputs($log_file, $output);
|
21
|
fclose($log_file);
|
22
|
|
23
|
|
24
|
$dir = '/var/www/data/tsf2/tiles/'.$pano_basename;
|
25
|
|
26
|
mkdir($dir,0777);
|
27
|
|
28
|
$dir_fd = opendir('/var/www/data/tsf2/vpongnian/panorama');
|
29
|
|
30
|
while (false !== ($image_name = readdir($dir_fd))) {
|
31
|
|
32
|
if(preg_match('/(.*)_[0-9]+_[0-9]+_[0-9]+\.jpg$/', $image_name, $reg)) {
|
33
|
rename("./".$image_name, $dir."/".$image_name);
|
34
|
}
|
35
|
|
36
|
}
|
37
|
closedir($dir_fd);
|
38
|
header("Location: ./index.php?");
|
39
|
}
|
40
|
?>
|