You are not logged in.

1

Thursday, January 26th 2012, 11:59am

Several beginner questions (show value from db in showtext, generate thumbnails from pano, open other website in virtual tour)

Hi,

I am just getting my feet wet with krpano and have the following three questions:
1) I understand that I can show a text on-hover of any hotspot. But I would like to query the latest value from a database on the server side and display it when user hovers mouse on hotspot. As per the example in this thread below is what I tried:

Javascript global function

Source code

1
2
3
4
function gettext() {
db_text = "some text";// I will replace the above with an AJAX call to get text snippet from the database, assume text returned by db gets stored in db_text
return db_text;
}


Later this is what I had in tour.xml

Source code

1
2
3
txtadd(var_with_varname, js(gettext()));
copy(var_content, get(var_with_varname));
showtext(get(var_content));



But hovering mouse over the hotspot shows "null" instead of the value returned by the javascript function.

2) I need to generate a thumbnail image after flattening out the pano. Is there any best-practice for doing this? Currently I am thinking of using one of the 6 tiles generated by the ktransform and converting that to a thumbnail

Source code

1
ktransform cube6 inputfile outputfile 


3) On clicking a hotspot, I would like to open a php website as a layer on top of a full-screen virtual tour. I think the openurl action just lets me open external URL's in the existing window, another frame or new window. Any suggestions on how to do this?

Thanks.
AA

2

Thursday, February 2nd 2012, 6:29pm

Hi,

to 1)
the krpano viewer is just calling the javascript function, but it doesn't receive any return values,
you would need to make a callback from javascript to krpano to pass/return a value,

e.g.
xml:

Source code

1
2
js( gettext(var_content) );
showtext(get(var_content));


js:

Source code

1
2
3
4
function gettext(varname)
{
  krpano.set(varname, ...);
}



to 2)
yes, that would be a possibility...


to 3)
the Flashplayer interface behind the openurl() action allows only these target: _blank, _self, _parent, _top,
but instead of using the openurl() action it would be possible to call a own Javascript function, that opens a new window, of course,

best regards,
Klaus