Sie sind nicht angemeldet.

a.pu

Schüler

  • »a.pu« ist der Autor dieses Themas

Beiträge: 120

Beruf: software engineer, author of krpano syntax highlighting, bundler and style guide

  • Nachricht senden

1

Montag, 17. Juni 2019, 12:08

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

Profi

Beiträge: 583

Wohnort: Barcelona

Beruf: creating ideas & coding them

  • Nachricht senden

2

Montag, 17. Juni 2019, 16:51

You can easily do that in php for example.

Quellcode

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

Schüler

  • »a.pu« ist der Autor dieses Themas

Beiträge: 120

Beruf: software engineer, author of krpano syntax highlighting, bundler and style guide

  • Nachricht senden

3

Freitag, 14. Februar 2020, 20:55

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

4

Freitag, 14. Februar 2020, 22:39

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

Quellcode

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

Fortgeschrittener

Beiträge: 330

Wohnort: Habana, Cuba

Beruf: Architect, Photographer.

  • Nachricht senden

5

Samstag, 15. Februar 2020, 01:30

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

Schüler

  • »a.pu« ist der Autor dieses Themas

Beiträge: 120

Beruf: software engineer, author of krpano syntax highlighting, bundler and style guide

  • Nachricht senden

6

Samstag, 15. Februar 2020, 08:38

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

Fortgeschrittener

Beiträge: 330

Wohnort: Habana, Cuba

Beruf: Architect, Photographer.

  • Nachricht senden

7

Dienstag, 18. Februar 2020, 00:17

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"