Home | Spelletjes | Uitvindingen | Gps | Scouting | Meteo | Computers

Ict / Viewing Panoramas In Pm Wiki Menu

Introduction

It was quite a puzzle to set up panorama viewing in PmWiki, so here a simple tutorial of how I did it.

The core is the Java-applet PTViewer, written bij Walter Dersch. In this article it is explained how to set up the server side. For the user is is left to make Java run in the browser on the client side. In almost all OS-es this is standard, so it will run without problems.

Use this at your own risk. Comments are welcome

Examples

You might first want to see the result

Install

First of course, you need to set up a PmWiki install on your site.

The root directory of your pmwiki install is referred to as pathtopmwiki/ throughout this document.

Then make you PmWiki Java ready. We use the recipe Applet for this. Download the file applet.php and place it in pathtopmwiki/cookbook

NB: I have slightly modified the code, here is my version.

Rename the file to applet.php. Use it if the official version runs problematic.

Add the line

include_once("$FarmD/cookbook/applet.php");

in pathtopmwiki/local/config.php

Now you are ready to install the panorama viewer.

Extract the file ptviewer.jar from the zip-archive at the PTViewer home site. There are to versions in the archive. Just take the full (larger) version, they hardly differ in size.

Create the directory pathtopmwiki/pub/applets and place the file ptviewer.jar in it. At the time of this writing version 2.8 is available.

We use the recipe PTViewer, and place the file ptviewer.php in pathtopmwiki/cookbook

Add the line

include_once("$FarmD/cookbook/ptviewer.php");

in pathtopmwiki/local/config.php

After this your site is capable to view panorama pictures.

Setting up a Panorama page

Here is a sample code to include in your page:

(:ptviewer width="500" height="375" file="Attach:mypanorama.jpg" pan="-90" tilt="5.0" fov="40" auto="0.1":)

In this case the file mypanorama.jpg is viewed in a 500x375 pixel box.

The arguments pan, tilt and fov stand for initial horizontal position, initial vertical position, and initial zoom. The values for these are obtained by setting the panorama in the desired start-position by moving the arrow-keys and then press 'v'. The values can then be read in the browsers status bar.

The argument auto is the initial rotation speed. 0.1 is a fine value, but it is highly dependent of the speed of the browser.

Advanced example

Hot-spots are red balls that come up on a specified position in the panorama when you press the space-bar. To obtain this effect add the following between the brackets in the ptviewer-command.

hotspot0="x1500 y900 n'A comment comes here'"

Places the comment in the status bar when you move over this red ball with your mouse. The x and y-coordinates are obtained using The Gimp.

Even more advanced:

hotspot1="x700 y1200 n'Some other comment' u'pmwiki.php?n=Pan.Picture2'"

Will load the page Pan.Picture2 if clicked on the hot-spot.

Limited panoramas

If your panorama is not 360 degrees round, I add:

panmin="-175" panmax="175"

Or any other value less then 180. The value is not critical. (I usually tend to forget measuring the actual degrees when I make a partly panorama.) This will prevent the viewer to stop panning at the borders.

All Combined

This commands displays your panorama with two hot-spots:

 (:ptviewer width="500" height="375" file="Attach:mypanorama.jpg" \
   pan="-90" tilt="5.0" fov="40" auto="0.1" \
   hotspot0="x1500 y900 n'A comment comes here'" \
   hotspot1="x700 y1200 n'Some other comment' u'pmwiki.php?n=Pan.Picture2'" \
 :) 

More options can be used, here is a full overview.

Notes on creating Panoramas

Making panoramas is very easy. I use a standard digital camera, set in automatic mode, and make about 12 pictures over 360 degrees. The pictures must have some overlap.

For stitching I use the tool Hugin, using standard settings. In 90% of the cases this gives me an acceptable panorama. If it is no good, I just go out again to make another set.

Then I use The Gimp to crop, resize and convert the panorama. The resulting picture will be about 4700*700 pixels in size with a jpeg-compression factor of 70%. This will result in a file of about 1Mbyte in size. Larger files will result in longer startup times. Some browsers will even have problems with very large panoramic pictures.

More examples

See my panorama-pictures again, but this time add ?action=source behind the URL to see the simple source code.

Departementen