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);">

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

    Thanks for your help

    Philippe

  • you could resort to php:

    image.xml.php:

    PHP
    <?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');

  • Hi Philippe,

    Or following your approach, you can do:


    Or similar:


    SAlut.

  • Hi

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


    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:

    Code
    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

  • Hi Philippe,

    In your code the image type is cube, not cubestrip *wink* ...
    The code corrected:

    SAlut.

  • 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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!