Projet

Général

Profil

Paste
Télécharger (2,05 ko) Statistiques
| Branche: | Révision:

root / genererPano.php @ f0cea9c4

1
<?php
2
require_once 'class/utils.class.php';
3
require_once 'class/site_point.class.php';
4
require_once 'class/TilesGenerator.php';
5
require_once 'constants.inc.php';
6

    
7

    
8
$fields_spec = array(
9
  'name'   => array('required', 'basename'), // name of the field within uploads dir
10
  'wizard' => array('boolean')
11
);
12

    
13
$validator = new FormValidator($fields_spec);
14
$is_valid = $validator->validate($_GET);
15

    
16
if ($is_valid) {
17
  $input = $validator->sane_values();
18
}
19

    
20
?>
21

    
22
<!DOCTYPE html>
23
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
24
<head>
25
  <meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
26
  <link type="image/x-icon" rel="shortcut icon" href="images/tsf.png"/>
27
  <title>convertiseur image vers panorama</title>
28
</head>
29

    
30
<body>
31

    
32
<?
33

    
34
if ($is_valid) {
35
  $image_path = UPLOAD_PATH.'/'.$input['name'];
36
  // We init the panorama with the same name as image.
37
  $pano_name = utils::strip_extension($input['name']);
38
  $panorama = site_point::get($pano_name);
39

    
40
  $tiles_generator = new TilesGenerator($image_path, $panorama);
41

    
42
  try {
43
    $tiles_generator->prepare();
44
    printf("<h2>Exécution de la commande :</h2>\n");
45
    printf("<p class=\"cmd\"><samp>%s</samp></p>\n",
46
           $tiles_generator->mk_command());
47

    
48
    echo "<pre>\n";
49
    $tiles_generator->process();
50
    print("</pre>\n");
51

    
52

    
53
    print("<h4><span class=\"success\">Opération réussie</span></h4>\n");
54
    printf("<p>Pour acceder directement au panorama <a href=\"%s\">cliquer ici</a></p>\n",
55
           $panorama->get_url());
56
    print("<p>Pour acceder à la liste des panoramas <a href=\".\">cliquer ici</a></p>\n") ;
57

    
58

    
59
    // Redirect in js to sumary page
60
    if ($input['wizard']) {
61
      printf('<script>window.location=\'panoInfo.php?name=%s\'</script>\n', $pano_name);
62
    }
63

    
64
  } catch (TilesGeneratorRightsException $e) {
65
    printf("<p class=\"error\">%s</p>\n", $e->getMessage());
66
  } catch (TilesGeneratorScriptException $e) {
67
    printf("<h4><span class=\"error\">%s</span></h4>\n", $e->getMessage());
68
    print("</pre>\n");
69
  }
70
} else { 
71
  $validator->print_errors(); 
72
}
73
?>
74
</body>
75
</html>