You are not logged in.

a.pu

Trainee

  • "a.pu" started this thread

Posts: 94

Location: Default city, Russia

Occupation: Vtour dev, design, UX and photography

  • Send private message

1

Monday, June 17th 2019, 12:08pm

Merge krpano sources into one file

Subj.

I have 30 separate files with code in a project.
I'd like to have a tool to merge all files in one before encrypting and uploading.
Does anyone have experience in that?

jordi

Intermediate

Posts: 501

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

2

Monday, June 17th 2019, 4:51pm

You can easily do that in php for example.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
$location = "/yourLocation/toFiles/"
$destination = "/yourDestination/"

$krpanoFiles = ["fileA","fileB",...];

foreach ($krpanoFiles as $file) {
	$mergedFile = $mergedFile."\n".file_get_contents($location.$file.'.xml');

	... do any extra function you need
}


file_put_contents($destination.'yourMergedXML.xml', $mergedFile);


You can execute that php directly on your computer without a server.
If you would like some custom code or any further feature here, please direct message me
everpano.com step beyond 360

a.pu

Trainee

  • "a.pu" started this thread

Posts: 94

Location: Default city, Russia

Occupation: Vtour dev, design, UX and photography

  • Send private message

3

Friday, February 14th 2020, 8:55pm

BTW, I have a solution for this :)
It's cumbersome but working

4

Friday, February 14th 2020, 10:39pm

Same, solution is here, but tough thing is to manage includes and relative paths, %SWFPATH%, %FIRSTXML%, etc...

I personally work with simplexml_load_file, with 2 args to replace %SWFPATH% and %FIRSTXML% on the go

Source code

1
2
3
4
5
6
7
8
9
 $PreLoaded = simplexml_load_file($CurrentXml);
 foreach($PreLoaded->include as $include){
 $IncludePath = $include['url'];

 !isset($FIRSTXML) ? : $IncludePath = str_replace('%FIRSTXML%', $FIRSTXML, $IncludePath);

 !isset($SWFPATH) ? : $IncludePath = str_replace('%SWFPATH%', $SWFPATH, $IncludePath);
 if (file_exists($IncludePath)) {
 ...



quite a pain, but working fine for our specific architecture.

Result is clear :
before : 120 files for a 12 seconds average load time
after : 1 file in < 1sec load time

Code is not really shareable as it really depends on folder structure and wouldn't work anywhere else but on our repositories.

Cheers

Fernando

Intermediate

Posts: 211

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

5

Saturday, February 15th 2020, 1:30am

Please, example.

Hi, the typical file structure (html5) generated from a krpano droplet is:

folders:
panos
plugins
skin


files:
tour.html
tour.js
tour.xml

Then in this example,
How to merge all above in one file?, for example index.html or index.php

Then any browser would be load it without local server (offline)?
If yes,
How to make it from windows 10?
Which requirements?

Thanks in advanced.
Fdo.

a.pu

Trainee

  • "a.pu" started this thread

Posts: 94

Location: Default city, Russia

Occupation: Vtour dev, design, UX and photography

  • Send private message

6

Saturday, February 15th 2020, 8:38am

Same, solution is here, but tough thing is to manage includes and relative paths, %SWFPATH%, %FIRSTXML%, etc...

I personally work with simplexml_load_file, with 2 args to replace %SWFPATH% and %FIRSTXML% on the go


Ouch
I use a lot of tricks, including initvars, folder structure, relative paths, js and a bit of php... This also helps to fix path issues.
I never use macro substitutions because they make code less clear and their values can not be obtained

I don't even know where to start, maybe make a repo first

Fernando, we talk a different thing.
Tour can not be 'compressed' to single html/php file. It won't make sense

Fernando

Intermediate

Posts: 211

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

7

Tuesday, February 18th 2020, 12:17am

I thought that you were referring to something like in this link:
link: https://krpano.com/docu/localusage/#embeddingallfilesKlaus explain how to "Embedding all files into the html file" in order to "Local / Offline Usage"