contact
This site is completely ad-free and therefore depends on your donation.
This site is completely ad-free and therefore depends on your donation.

qtkrparse.php QTVR-files for KRPano

image: qtkrparse.php

current version: 3.0.2


Purpose

qtkrparse.php has two functions: The first part reads parameters and offsets of images from a Quicktime VR file and creates from this a XML file, a file with the offset info and a preview image. The second part loads the image data directly from the QTVR-file into the krpano player with help from the krpano numbering and the offsets file.


Prerequisites

The server must be suitable for KRPano of course and must be able to execute PHP scripts. qtkrparse.php must reside in the same directory as the QTVR file(s) (it is possible to mirror qtkrparse.php by mod_rewrite). PHP must have write rights in this directory.

krpano must be at least version 1.1.8.

The QTVR-files must contain only Jpeg-compressed images. Header compression is not supported. qtkrparse issues an error message via krpano if such a file is found.


Usage

qtkrparse.php must be used with the QTVR file as GET parameter "mov" instead of the XML file by embedpano:

<script src="/krpano.js"></script>
<script>
  embedpano({swf:"krpano.swf",
             xml:"qtkrparse.php?mov=my.mov",
             target:"krpano-div-id",
             html5:"auto"});
</script>
  

For details on how to embed krpano please see: http://www.krpano.com/docu/html/

The flash version can be called directly by GET parameter:

krpano.swf?pano=qtkrparse.php%3Fmov=mein.mov
The second GET-delimiter "?" must be masked as "%3F".


Details

  • qtkrparse.php uses a good deal of code from qtparser.php by Aldo Hoeben: http://fieldofview.com
  • qtkrparse.php includes a file krpano.inc if present. This file can contain additional XML code since qtkrparse.php creates only a basic file containing <krpano>, <preview>, <view>- and <image> tag (with <level> sub-tag). All other tags must be included through this file.
  • The following <view> attributes are read from the QTVR file: hlookat, vlookat, fov, fovmin, fovmax, hlookatmin, hlookatmax, vlookatmin and vlookatmax
  • The following <view> attributes are preset by qtkrparse.php: fisheye="0", fisheyefovlink="0.5", limitfov="true", camroll="0.0"
  • If hlookatmin - hlookatmax = 360° and vlookatmin - vlookatmax = 180° (wich displays the whole sphere) limitview is set to "lookat" else to "range".
  • All these <view> attributes can be overwritten in the javascript code, f.e. to know the promise of the fisheye function of krpano:
      var so = document.getElementById("krpanoSWFObject");
      so.set("view.fisheye","0.35");
      so.set("view.fovmax","179");
    
  • if called the first time with a particular QTVR qtkrparse.php writes two or three files to the directory of the QTVR file. One with the extension of .xml, one with .ofs and the optional .jpg preview image. The names of all files are made up from name und extension of the QTVR file. my.mov f.e. results in my_mov_kr.xml, my_mov_kr.ofs and my_mov_prv.jpg. All subsequent calls read those files, except their creation date is older than the QTVR file or qtkrparse.php. In this case new files are written. This can be forced with the parameter cache=reset, f.e.:
    qtkrparse?mov=mein.mov&cache=reset
  • If relative path should be used (f.e. to use a single copy of krpano for multiple directories) they must be specified in the qtkrparse.php call, not in the QTVR file URL:
      embedpano({swf:"krpano.swf",
                 xml:"../mypath/qtkrparse.php?mov=my.mov",
                 target:"krpano-div-id",
                 html5:"auto"});
          
  • The creation and usage of preview images can be switched off in qtkrparse.php by setting = false;
  • Preview images will be displayed the second time a panorama is viewed.


Version History

v1.0: 2008-6-12
- first public Version
v1.1: 2008-6-22
- "Expires" and "Last-Modified" header set in order to allow caching
v1.2: 2008-7-24
- compatible with recent php versions
v2.0: 2008-8-18
- uses an optional QTVR preview image
- internal error mechanism now uses current error_reporting setting.
v2.0.1: 2008-9-9
- bugfix: apache_request_headers caused error if not defined.
v2.1: 2008-9-16
- Subtiled cube faces can now contain an even number of subtiles along one side, too (2x2, 4x4, 6x6,...)
v3.0: 2016-11-11
- Support of krpano HTML5 viewer (and hence for tablets und smartphones)
v3.0.1: 2016-12-11
- added krpano projections context menu (in krpano.inc)
v3.0.2: 2017-08-22
- PHP 7 compatibility


Examples / Debugging

All Sphericals on http://pano.erik-krause.de are displayed with the help of qtkrparse.php. The calls are hidden behind some rewrite rules. But you can call the panoramas manually, too:

These kind of calls can be used f.e. to determine the reason why a panorama won't display.


HTML-Converter

In order to use existing HTML pages with embedded QTVR without the need to create them again convert2.php is enclosed (originally from the Birdcap-package by Bernhard Vogl) To display an existing page with krpano pass it as a parameter to convert2.php in a link, f.e.:

<a href="convert2.php?file=panorama.html">interactive panorama</a>
convert2.php replaces the <object> and <embed> Quicktime tag by an appropriate call of embedpano.


.htaccess examples

If your .htm files containing QTVR panoramas can be recognized with a certain pattern the work can be done by some rewrite rules.

  # switch rewriting on
RewriteEngine on
  # assuming your folder containing krpano, qtkrparse.php and convert2.php is /tools
  # redirect all calls to convert2.php into /tools
RewriteRule (^|/)convert2\.php$ tools/convert2.php [L]
  # redirect all calls to qtkrparse.php into /tools
RewriteRule (^|/)qtkrparse\.php(.*)$ tools/qtkrparse.php$2 [L]
  # redirect all calls to krpano into /tools
RewriteRule (^|/)krpano\.(.*)$ tools/krpano.$2 [L]
  # assuming all of your htm files containing QTVR panoramas are named *_qt.htm
  # call convert2.php with the file name as parameter
RewriteRule ^(.*)/([^./]+_qt)\.htm$ /$1/convert2.php?file=$2.htm [L]
  

download

For questions, suggestions, comments and corrections please contact me

© Erik Krause 2016 - 2018

Download qtkrparse.zip


© Erik Krause 2008 - 2018 All images on this pages are protected by copyright law. Any use - even pivate - requieres written permission by the author!

contact

Erik Krause
Herchersgarten 1
D-79249 Merzhausen
e-Mail: Erik Krause

data protection

This page does not collect any data
The IP address in the server logs is anonymized.