de en

WP-PTViewer: Solution for 404 and new Function auto

Friday, July 11th, 2008 | Author: Andreas

As written, the reason for the 404 error is caused by the applet ptviewer.jar.

This error message the user didn’t see because the applet is running without any problems. Nevertheless, 404 messages are not satisfactory.

Finally, I find a solution by redirecting via .htaccess.

The following line must be inserted into the file .htaccess:

RedirectMatch 301 ^(.*)/PTDefault.html$ XXX/PTDef.html

The XXXX you have to adjust to the correct path, for example http://meinblog.de/panos/PTDef.html. In addition, there must exist of course also a file with the name PTDef.html. Just create a blank file and upload it.

Further information on RedirectMatch can be found on apache.org.

After all, requests for PTDefault.html are now forwarded to one single file, it is not longer possible to use different default start values for different instances. Especially the auto-rotate function I would like to assign to each panorama separately. For this reason I made some small modifications in the script plugin-class.php of WP PTViewer.

The file “plugin-class.php” is located in the directory includes:

Line 115 ‘auto’ => “, insert:

'horizon' => '',
'hfov' => '',
'auto' => '',
'width' => $this->options['default_applet_width'],
'height' => $this->options['default_applet_height'],

Line 148, $auto add:

if ($errors=='') {
$output .= $this->get_applet_html($width, $height, $image_url,
$imagewidth, $imageheight, $horizon, $hfov, $auto);
}

Line 173 $output .= “<li>Auto: ” . $auto . “</li>”; insert:

$output .= "<li>Horizontal FOV: " . $hfov . "</li>";
$output .= "<li>Auto: " . $auto . "</li>";
$output .= "<li>CSS class: " . $cssclass . "</li>";

Line 189, $auto add:

function get_applet_html($applet_width, $applet_height,
$image_url, $image_width, $image_height, $horizon, $hfov , $auto) {

Line 220 and Line 235 insert

$htmlCode .= ‘<param name=”auto” value=”‘ . $auto . ‘”></param>’;:

$htmlCode .= '<param name="tiltmax" value="' . $tiltmax . '"></param>';
$htmlCode .= '<param name="auto"    value="' . $auto . '"></param>';
$htmlCode .= '</applet>';

You can also download my modified plugin-class.txt. After downloading rename this file to plugin-class.php and place it in the directory …/plugins/wp-ptviewer/includes. It is maybe a good idea to rename the original file first or save it somewhere.

Now a new parameter (auto) is available.

Example:

ptviewer href="http://meinblog.de/.../panorama.jpg"
imagewidth="x" imageheight="y" horizon="z" hfov="h" auto="0.1"]
Beschreibung [/ptviewer]

Here you can see it in action.

A negative value for auto means a move to the left side at startup, a positive value to the right. The speed depends on the value.

If this article helped you, please refer to it or write a comment. As you can see, this weblog is quite young and I welcome any feedback. ;-)

Thanks to Vincent Prat for making WP-PTViewer.

Related Posts

Tags » , «

Trackback: Trackback-URL | Comments Feed: RSS 2.0
Category: Wordpress

You can leave a response.

Leave a Reply

Hints for comments:
You also want to have a avatar beside your comment? Than you have to get an account at Gravatar.com and your picture will shown automatically beside your comment in a lot of Wordpress-blogs.
If your comment contains too many links it has to be released by the moderator, this may take some time. Nevertheless, I would be delighted if you would leave some lines.