Hi!
I think I found a solution to reduce the amount of code lines within the scene. This involves adding some lines of php code and renaming and calling the krpano.xml file with the name krpano.xml.php
At the beginning of the xml.php document I added the following code (edit the url lines according to the location of your saved pano-images):
|
Quellcode
|
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
|
<?php
function makescene($scene){
echo'
<preview url="../pano/'.$scene.'/preview.jpg"/>
<image type="CUBE" multires="true" tilesize="390" progressive="false">
<level tiledimagewidth="2483" tiledimageheight="2483">
<left url="../pano/'.$scene.'/l3_l_%0v_%0h.jpg" />
<front url="../pano/'.$scene.'/l3_f_%0v_%0h.jpg" />
<right url="../pano/'.$scene.'/l3_r_%0v_%0h.jpg" />
<back url="../pano/'.$scene.'/l3_b_%0v_%0h.jpg" />
<up url="../pano/'.$scene.'/l3_u_%0v_%0h.jpg" />
<down url="../pano/'.$scene.'/l3_d_%0v_%0h.jpg" />
</level>
<level tiledimagewidth="1242" tiledimageheight="1242">
<left url="../pano/'.$scene.'/l2_l_%0v_%0h.jpg" />
<front url="../pano/'.$scene.'/l2_f_%0v_%0h.jpg" />
<right url="../pano/'.$scene.'/l2_r_%0v_%0h.jpg" />
<back url="../pano/'.$scene.'/l2_b_%0v_%0h.jpg" />
<up url="../pano/'.$scene.'/l2_u_%0v_%0h.jpg" />
<down url="../pano/'.$scene.'/l2_d_%0v_%0h.jpg" />
</level>
<level tiledimagewidth="621" tiledimageheight="621">
<left url="../pano/'.$scene.'/l1_l_%0v_%0h.jpg" />
<front url="../pano/'.$scene.'/l1_f_%0v_%0h.jpg" />
<right url="../pano/'.$scene.'/l1_r_%0v_%0h.jpg" />
<back url="../pano/'.$scene.'/l1_b_%0v_%0h.jpg" />
<up url="../pano/'.$scene.'/l1_u_%0v_%0h.jpg" />
<down url="../pano/'.$scene.'/l1_d_%0v_%0h.jpg" />
</level>
<mobile>
<left url="../pano/'.$scene.'/mobile_l.jpg" />
<front url="../pano/'.$scene.'/mobile_f.jpg" />
<right url="../pano/'.$scene.'/mobile_r.jpg" />
<back url="../pano/'.$scene.'/mobile_b.jpg" />
<up url="../pano/'.$scene.'/mobile_u.jpg" />
<down url="../pano/'.$scene.'/mobile_d.jpg" />
</mobile>
<tablet>
<left url="../pano/'.$scene.'/tablet_l.jpg" />
<front url="../pano/'.$scene.'/tablet_f.jpg" />
<right url="../pano/'.$scene.'/tablet_r.jpg" />
<back url="../pano/'.$scene.'/tablet_b.jpg" />
<up url="../pano/'.$scene.'/tablet_u.jpg" />
<down url="../pano/'.$scene.'/tablet_d.jpg" />
</tablet>
</image>';
}
?>
|
To call the function with the code snippet just add
|
Quellcode
|
1
|
<?php makescene(***); ?>
|
where *** represents the name of your panorama you want to load. Add this line in every <scene>. Of course you also have to remove the code for the preview and the image in your scenes.
I hope this helps making your scenes better editable and more lightweight!
**Edit: I realize that this won't change the size of data transferred from the server to the browser, as the functions are rendered on the server. So the xml file you get in the end will have about the same size as before…
**Edit2: And of course your server needs to have php enabled…