-
Notifications
You must be signed in to change notification settings - Fork 1
/
genererPano.php
75 lines (58 loc) · 2.05 KB
/
genererPano.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
require_once 'class/utils.class.php';
require_once 'class/site_point.class.php';
require_once 'class/TilesGenerator.php';
require_once 'constants.inc.php';
$fields_spec = array(
'name' => array('required', 'basename'), // name of the field within uploads dir
'wizard' => array('boolean')
);
$validator = new FormValidator($fields_spec);
$is_valid = $validator->validate($_GET);
if ($is_valid) {
$input = $validator->sane_values();
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<link type="image/x-icon" rel="shortcut icon" href="images/tsf.png"/>
<title>convertiseur image vers panorama</title>
</head>
<body>
<?
if ($is_valid) {
$image_path = UPLOAD_PATH.'/'.$input['name'];
// We init the panorama with the same name as image.
$pano_name = utils::strip_extension($input['name']);
$panorama = site_point::get($pano_name);
$tiles_generator = new TilesGenerator($image_path, $panorama);
try {
$tiles_generator->prepare();
printf("<h2>Exécution de la commande :</h2>\n");
printf("<p class=\"cmd\"><samp>%s</samp></p>\n",
$tiles_generator->mk_command());
echo "<pre>\n";
$tiles_generator->process();
print("</pre>\n");
print("<h4><span class=\"success\">Opération réussie</span></h4>\n");
printf("<p>Pour acceder directement au panorama <a href=\"%s\">cliquer ici</a></p>\n",
$panorama->get_url());
print("<p>Pour acceder à la liste des panoramas <a href=\".\">cliquer ici</a></p>\n") ;
// Redirect in js to sumary page
if ($input['wizard']) {
printf('<script>window.location=\'panoInfo.php?name=%s\'</script>\n', $pano_name);
}
} catch (TilesGeneratorRightsException $e) {
printf("<p class=\"error\">%s</p>\n", $e->getMessage());
} catch (TilesGeneratorScriptException $e) {
printf("<h4><span class=\"error\">%s</span></h4>\n", $e->getMessage());
print("</pre>\n");
}
} else {
$validator->print_errors();
}
?>
</body>
</html>