FvL Media's Simple PHP Panoviewer II

I've made this simple panoviewer to give my customer a fast preview. What it does is simply to look through a directory and sort and display all jpg-files* as panoramas using ptviewer. It is restricted to use same fov, tiltmin etc. for all pano in a tour.


NEW in this version:
- As an alternative to change the default parameters in the main script, you can now put the variables in a text-file named 'param.inc'. The script automatically looks for this file - and if present the variables from this will be used.
- Added 'sz'-variable which holds thedirectory name to different sized pano-files. Defalt to none. The new directory must be inside the 'pano'-directory - You can name it what ever you like, e.g. &sz=big, as long as it conforms to the path standard of your server [ you should not use space though!] As the script still collects the filename-list from the files in the root of pano-directory, the filename must be the same as the standardsized versions.

New in last update:
- Added 'pft'-variable for pano-extension. Default 'jpg' - can be set to jpc / jpa / mov or other ext. [In the old version it would try to display any file in the pano-subdir as panorama = red ptviewer if not a picture-file]. If you use another format than jpg remember to have the needed class-files in ptviewer.jar .
- CHANGE!! Now if you set the Url-variable &usc=yes the filenames in the scroll-list are split at first occurance of character '_' [underscore] , so that anything before is removed. E.g. if you name your files 001_Exterior, 002_Garden_view, etc. the list will discard the 001_ and 002_ and only show . The default is now &usc=no.
[ I had to change it this way, as the former script would diplay empty items in the listmenu if the filename didn't contain '_'. If you alway have a number prefix with underscore you can change the default to 'yes' - see below ]

Here is what you need:

  1. PHP-installation [ download from www.php.net or www.foxserv.net - the foxserv-packages includes apache and mysql and is really easy to install - works fine with Window XP Home ]
  2. A PHP-shared** main directory containing the simpleview.php scriptfile and ptviewer.jar [download simpleview.php zipped]
  3. Your pano.jpg- files*** should be in a subdirectory called "pano" of a subdiretory called whatever you want***.
  4. If you want your own wait-image [logo] it should be in a subdirectory called "images".

*NEW: The first version listed and tried to display all files in the pano-dir, even non picture files. It'll now only list files with the extension 'jpg' or the extension set by variable pft [se below].

** You need some kind of server to run PHP and you have to web-share the main directory - read more on www.php.net - if you have window xp home [that won't work with MS Personal Webserver] I'll recommend installing apache-server via www.foxserv.net.

***The panos will be sorted in alphanumeric order, so if you want a certain order you should name your panofiles with a numeric prefix [ like 01_exterior.jpg ]. As all jpg-files are listed, the pano-directory, should only contain panorama jpg's.

**** The directory structure:

[main directory - PHP-shared]
         ------ [subdirectory e.g. "house104" ]---[subdirectory "pano" - only contain panos-jpg*]
         ------ [subdirectory "images" ]

To run the simpleview.php you then have to provide at least one URL-variable, the post-variable, like this:

simpleview.php?post=house104 [click to see example]

the post-variable is the name of the first subdirectory.

Here is a full list of URL-variables you can set :

post: the name of the first subdirectory ***
w and h: the width and height of the applet-window
pID: first pano to show [used on where newPanoFromList doesn't work and you have to reload entire page or if you want to make links for individual panos - e.g from anexternal text-link or image map]
fov: initial fov value
tiltmin: e.g = -70 to hide tripod
logo: name of the wait-image
bgcolor: page backgroundcolor [for color you can use either plain text like red, gray, .. or hex like 000000, AA00FF]
tcolor: text color
tbcolor: table backgroundcolor
title: Title writen above the panoview - use %20 for space
pft: extension for your pano - set this if you use compressed jpa/jpc - if not set it looks for jpg.
usc: set to 'yes' if you want to clean prefix number [001_] from the listnames.
sz: the name a subdirectory[of the pano-directory] for differnt sized pano.jpgs.

and here is an example URL with all variables set:


and here are some other examples:



simpleview.php?post=qtvrtest&pft=mov&usc=yes&w=550&h=400 [ use ptmviewer.class to display qtvr.mov ]

For the URL-variables not set some default are set in the php-script. If you allways use the same values, you can change them to you own default. Look for this code at the top of the simpleviewer.php [the value to change are showed in red here]:

$post = $_GET['post'];
$fdir = $post.'/pano';
$ps = split ('[/]', $post);
$pID = (!isset($_GET['pID'])) ? '0': $_GET['pID'];
$fov = (!isset($_GET['fov'])) ? '80': $_GET['fov'];
$tmin = (!isset($_GET['tiltmin'])) ? '0': $_GET['tiltmin']; zero means ptviewer-default -90
$w = (!isset($_GET['w'])) ? '500': $_GET['w'];
$h = (!isset($_GET['h'])) ? '325': $_GET['h'];
$logo = (!isset($_GET['logo'])) ? 'fvlview.gif': $_GET['logo'];
$bgcol = (!isset($_GET['bgcolor'])) ? '000000': $_GET['bgcolor'];
$tcol = (!isset($_GET['tcolor'])) ? 'ffffff': $_GET['tcolor'];
$tbcol = (!isset($_GET['tbcolor'])) ? '777777': $_GET['tbcolor'];
$tit = (!isset($_GET['title'])) ? 'Pano Preview': $_GET['title'];
$pft = (!isset($_GET['pft'])) ? 'jpg': $_GET['pft'];
$usc = (!isset($_GET['usc'])) ? 'no': $_GET['usc'];
$sz = (!isset($_GET['sz'])) ? '': $_GET['sz']."/";

You can also keep individual variables in an include textfile named 'param.inc' placed in each main subdirectories [e.g. 'house104'] . You can set one or all of the variables above from $pID and down - The structure of the text-file is like this:

   $tit = 'Take a look around';
   $fov = '90';
   $tmin = '-75';
   $w = '450';
   $h = '330';

If you don't have PHP on your online server you can grab and copy the code from the webbrowser and save as html-file. Only thing that won't work is the jump-menu on browser that won't allow communication between java and javascript [ mainly IE on mac ] as it rely on the pID-variable - for these cases you have to save as individual html-files :-(

TIP! You can make a simple customer login page to go to the simpleviewer. All you need is a form with a field where the customer enter their subdirectory as password and rest of the variables are set as hidden fields. Here is en example [ you can copy the code as is and/or add/erase hidden fields - it'spure html and javascript ]:

customer login [use 'house104' as password in this example]


Flemming V. Larsen