Sie sind nicht angemeldet.

1

Mittwoch, 9. November 2011, 11:21

variable syntax in url

Hi,

I can set variables in my xml file, except in <image> tag. I've searched in documentation and in the forum but I didn't find.

<scene name="scene3" onstart="action(startscene);">

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
<scene name="scene3" onstart="action(startscene);">

<action name="startscene">
set (var1,MyPanoName);
</action>

<preview type="CUBESTRIP" url="get(var1)/preview.jpg" />
<image>
	<cube url="get(var1)_%s.jpg"/>
</image>

</scene>


I've tried many ways, but is it ever allowed to use vars in url ?

Thanks for your help

Philippe

2

Mittwoch, 9. November 2011, 12:40

Hi!
No way to use variables directly in attributes *mellow*
Sorry

Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

3

Mittwoch, 9. November 2011, 13:51

you could resort to php:

image.xml.php:

Quellcode

1
2
3
4
5
6
7
8
<?php
   $panoname = 'test';
?>
 
<preview type="CUBESTRIP" url="get(var1)/preview.jpg" />
<image>
	<cube url="<?php echo $panoname; ?>_%s.jpg"/>
</image>


or you could set the url through html addVariable

var panoname = 'test'; //or get it from url
viewer.addVariable('image.cube.url', panoname + '_%s.jpg');

4

Mittwoch, 9. November 2011, 17:08

Hi Philippe,

Or following your approach, you can do:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
<scene name="scene3" onstart="action(startscene);">

	<action name="startscene">
		set(var1,MyPanoName);
		txtadd(preview.url,get(var1),/preview.jpg);
		txtadd(image.cubestrip.url,get(var1),_%s.jpg);
	</action>

	<preview type="CUBESTRIP" url="" />
	<image>
		<cube url=""/>
	</image>

Or similar:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<scene name="scene3" onstart="startscene(MyPanoName);">

	<action name="startscene">
		txtadd(preview.url,%1,/preview.jpg);
		txtadd(image.cubestrip.url,%1,_%s.jpg);
	</action>

	<preview type="CUBESTRIP" url="" />
	<image>
		<cube url=""/>
	</image>

</scene>


SAlut.

5

Mittwoch, 9. November 2011, 19:35

Hi

Thank you all for your responses.
I tried (the only script that shows something):

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<scene name="scene3" onstart="startscene(Pano1);">

	<action name="startscene">
		txtadd(preview.url,%1,/preview.jpg);
		txtadd(image.cubestrip.url,%1,"/",%1,_%s.jpg);
	</action>

	<preview type="CUBESTRIP" url="" />
	<image>
		<cube url=""/>
	</image>

</scene>

Just added ,%1,"/" because files ares in a folder.
The preview works fine, but the image (which is in the same folder) doesn't load, even when I replace %s with:

Quellcode

1
2
3
4
5
6
	        txtadd(image.cubestrip.url,%1,"/",%1_l.jpg);
		txtadd(image.cubestrip.url,%1,"/",%1_f.jpg);
		txtadd(image.cubestrip.url,%1,"/",%1_r.jpg);
		txtadd(image.cubestrip.url,%1,"/",%1_b.jpg);
		txtadd(image.cubestrip.url,%1,"/",%1_u.jpg);
		txtadd(image.cubestrip.url,%1,"/",%1_d.jpg);

Strange. The error message says : ERROR: download of "pano1/pano1_%s.jpg" failed - in the first case - and nothing appears when naming images l f r b u d : only one image pano1_d loads but doesn't appear (I see it in Safari console only).
I can't see what is missing.

Thanks for your help

Philippe

6

Mittwoch, 9. November 2011, 22:35

Hi Philippe,

In your code the image type is cube, not cubestrip ;-) ...
The code corrected:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<scene name="scene3" onstart="startscene(Pano1);">

	<action name="startscene">
		txtadd(preview.url,%1,/preview.jpg);
		txtadd(image.cube.url,%1,/,%1,_%s.jpg);
	</action>

	<preview type="CUBESTRIP" url="" />
	<image>
		<cube url=""/>
	</image>

</scene>


SAlut.

7

Mittwoch, 9. November 2011, 22:52

NICE ! you're right : I could never have found it.

Thanks you all !

Philippe

8

Donnerstag, 10. November 2011, 01:11

Hi!
One more thing, this will work only if you change image and preview in onstart event.
This not work after. Another words you can't set url of image or preview by clicking some button or else way

Regards
Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

9

Donnerstag, 10. November 2011, 08:42

Hi Andrey

Thanks for that clarification !

regards

Philippe

10

Freitag, 11. November 2011, 13:38

Hi,

to be exact - there is a possibility to use variables inside urls - but only when these variables were defined BEFORE the current xml or scene was loaded - that means these variables must be defined/set either in the HTML file - or before a loadpano() or loadscene() call,

see here for details:
Questions about flash caching

best regards,
Klaus

Hellkeeper

Fortgeschrittener

Beiträge: 164

Wohnort: St. Johann in Tirol

  • Nachricht senden

11

Freitag, 28. April 2017, 21:59

Hi,

to be exact - there is a possibility to use variables inside urls - but only when these variables were defined BEFORE the current xml or scene was loaded - that means these variables must be defined/set either in the HTML file - or before a loadpano() or loadscene() call,

see here for details:
Questions about flash caching

best regards,
Klaus


Klaus - is this still valid for HTML5 Player as well? As I would need to build Image Path with Variables ...
I try it like that:

<level tiledimagewidth="640" tiledimageheight="640">
<cube url="%$domain%/my/path/9/tiles/mres_%s/l1/%v/l1_%s_%v_%h.jpg" />
</level>

Any ideas on that?

thx
Andreas Schnederle-Wagner
Andreas Schnederle-Wagner
Rundblick GmbH / Gigapixel aus Österreich
https://www.rundblick.at/
https://www.gpix.at