You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

1

Wednesday, September 29th 2010, 5:34pm

Take hlookat vlookat and fov from the url ?

Hi, I'm trying to reproduce what has been done on http://www.paris-26-gigapixels.com and it's "Share you position' feature (naughty me...)
It's allright to record the position, create an url and send it on facebook, but the problem is that the params in the url aren't read by the player...
the url goes like this :

Source code

1
http://www.360images.fr/360/angers_haute_def/angers.html?x=27&y=3&z=19

and x , y and z doesn't mean anything to krpano !
I'm missing something but I just can't find what...
Thanx for your help in advance !!!

PS: you can try the share your position button here :http://www.360images.fr/360/angers_haute_def/angers.html

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

2

Wednesday, September 29th 2010, 6:49pm

Ok, i'm just missing a javascript function to get param from the adress bar (function setView()) but I just can't find it ...
I guess it says hlookat =x vlookat=y fov=z but I just don't know anything about java...

3

Thursday, September 30th 2010, 7:13am

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var qs = window.location.search.substring(1);
var qs_parts = qs.split('&');
var qs_params = [];
var tmp;
for (var i=0;i<qs_parts.length;++i) {
  tmp = qs_parts[i].split('=');
  qs_params[tmp[0]] = tmp[1];
}

// Now query string parameters should be available as
// qs_params['x'];
// qs_params['y'];
// qs_params['z'];
alert('x is '+qs_params['x']+', y is '+qs_params['y']+', z is '+qs_params['z']);

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

4

Thursday, September 30th 2010, 2:00pm

Thanx risa, but the only thing your script tells me when I try http://www.360images.fr/360/angers_haute…l?x=27&y=3&z=19 for example is "x is 27, y is 3, z is 19"...
So it reads all right the url but don't tell krpano.swf to take thoses parmas...
Or maybe i'm doing something wrong ?

5

Thursday, September 30th 2010, 3:44pm

Not sure that this will work but try this:

Source code

1
2
3
4
5
var so = createswf('krpano.swf'); // this line might be different for you
so.addVariable('xml', 'your.xml'); // this line might be different for you
so.addVariable('view.hlookat', qs_params['x']);
so.addVariable('view.vlookat', qs_params['y']);
so.addVariable('view.fov', qs_params['z']);

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

6

Thursday, September 30th 2010, 4:30pm

Wouhouuuuuuuuuuuuuuuuuuuu, brilliant srisa !!!!
It's almost working !!!
Works perfect if the paramas x y z are in the url, but if there is no paramas then it displays a black screen loading and loading again...
Guess it needs a "if" somewhere ?

Source code

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
	// <![CDATA[
		if (typeof(deconcept) !== 'undefined' && deconcept.SWFObjectUtil.getPlayerVersion().major >= 6)
		{
		var qs = window.location.search.substring(1);
		var qs_parts = qs.split('&');
		var qs_params = [];
		var tmp;
		for (var i=0;i<qs_parts.length;++i) {
 		 tmp = qs_parts[i].split('=');
 		 qs_params[tmp[0]] = tmp[1];
		 
			var so = new SWFObject("krpano.swf", "krpanoSWFObject", "100%", "100%", "9.0.28","#000000");
			so.addVariable("xml","angers.xml");
			so.addVariable('view.hlookat', qs_params['x']);
			so.addVariable('view.vlookat', qs_params['y']);
			so.addVariable('view.fov', qs_params['z']);
			if ( so.write("krpanoDIV") ) { var mousewheelfixes = new SWFkrpanoMouseWheel(so); }
}

		}
		else
		{
			document.getElementById("krpanoDIV").innerHTML = '<table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br/><br/>Adobe Flash Player 9 needed<br/><br/><br/><a href="http://www.adobe.gigapixel/go/getflashplayer/"  target="_blank"><IMG SRC="http://www.macromedia.com/images/shared/download_buttons/get_flash_player.gif" BORDER="1"></a><br/>...click here to download...<br/><br/><br/><br/></center></td></tr></table>';
		}
		
	// ]]>

7

Friday, October 1st 2010, 8:31am

Hi, try that:
if(qs_params['x']) so.addVariable('view.hlookat', qs_params['x']);
if(qs_params['y']) so.addVariable('view.vlookat', qs_params['y']);
if(qs_params['z']) so.addVariable('view.fov', qs_params['z']);

jeromebg

Professional

  • "jeromebg" started this thread

Posts: 803

Location: Angers - France

Occupation: Photographer

  • Send private message

8

Friday, October 1st 2010, 9:09am

Perfect !
Thanx Klaus & srisa !!!

9

Friday, October 15th 2010, 8:30am

Hi Guys,



I'm just landing here in this thread and loved the solution.

How can I implement here in my end, with an aditional that I have a tour with several panos (xml) and the link to facebook or twitter should get also the current xml url?

Jeromebg!! Congratulations!! Really nice work!!!!

Using that Javascript, how did you call it inside krpano xml??

Thanks,

Daniel

10

Saturday, October 16th 2010, 7:47pm

Add another variable to the query string, like so, url=mypano.xml. Using the above mentioned javascript, you can access it as qs_params['url'].

Source code

1
so.addVariable('xml', qs_params['url']);

11

Sunday, October 17th 2010, 7:27am

Sorry,

Just to understand it clearly....

I need to create a javascipt file (.js), make the html load it and on the xml button to facebook, what should I insert on the onclick="" field?

Thanks!!!

Daniel