Projet

Général

Profil

Révision 7096d2f9

Ajouté par Jocelyn Dealande il y a environ 10 ans

Refacto of Tiles handling and simplified a bit file naming for tiles/params.
By the way, fixes #297

THIS COMMIT BREAKS FILE LAYOUT AND REQUIRES MIGRATION (SEE BELLOW).

To migrate data :

cd tiles
find . '*.jpg' -exec rename 's/[^\/]*_(([0-9]{3}_){2}([0-9]{3}))/$1/' {} \;
rename 's/(.*\/).*\.params/$1site.params/' */*.params

Voir les différences:

panorama.php
3 3
<head>
4 4
  <?php
5 5
   require 'class/utils.class.php';
6
   require_once('class/Tile.class.php');
7

  
6 8
   require_once 'constants.inc.php';
7 9

  
8 10
  $fields_spec = array(
......
67 69
  <script>
68 70
  <?php
69 71
     $zoom_array = $pt->get_magnifications();
70

  
71 72
     foreach($zoom_array as $zoom => $val) {
73
       $first_tile = new Tile($pt, $zoom, 0, 0);
74
       $last_tile = new Tile($pt, $zoom, $val['nx']-1, $val['ny']-1);
75

  
72 76
       echo "zooms[$zoom] = new tzoom($zoom);\n";
73 77
       echo "zooms[$zoom].ntiles.x = ".$val['nx'].";\n";
74 78
       echo "zooms[$zoom].ntiles.y = ".$val['ny'].";\n";
75
       $size = getimagesize(sprintf($base_dir.'/'.$prefix.'_%03d_%03d_%03d.jpg', $zoom, 0, 0));
79
       $size = $first_tile->dimensions();
76 80
       echo "zooms[$zoom].tile.width = ".$size[0].";\n";
77 81
       echo "zooms[$zoom].tile.height = ".$size[1].";\n";
78
       $size = getimagesize(sprintf($base_dir.'/'.$prefix.'_%03d_%03d_%03d.jpg', $zoom, $val['nx']-1, $val['ny']-1));
79
       echo "zooms[$zoom].last_tile.width = ".$size[0].";\n";
80
       echo "zooms[$zoom].last_tile.height = ".$size[1].";\n";
82
       // Last tile usually have a "remainder" size
83
       $last_size = $last_tile->dimensions();
84
       echo "zooms[$zoom].last_tile.width = ".$last_size[0].";\n";
85
       echo "zooms[$zoom].last_tile.height = ".$last_size[1].";\n";
81 86
     }
82

  
83 87
   $dir_list = new sites_dir($dir);
84 88

  
85 89
   $ipt = 0;

Formats disponibles : Unified diff