AIR-Box plugin for PHPBB

For the site I’m working on it is likely the forums will have lots of photo posting and those photos could be large. As such, we wanted a way to auto-resize the posted photos but allow access to the full sized photo. Enter AIR-Box.

I tried installing AIR-Box with AutoMod. I kept getting errors. I tried forcing the install. It said the install succeeded, but none of the required changes were present. In the end I manually installed the plugin. I was still having problems.

Part of the problem had to do with WP-United. WP-United removes parts of the PHPBB code in order to avoid having two <head> or </body> tags in the same page. It was cutting off the page at a crucial part for AIR-Box. I moved the code and was still having problems. I found that the class “postimage” was not being attached to the photos. I think this was because I was using a subsilver2 theme in PHPBB and the plugin is made for prosilver or subsilver. I found the template bbcode.html in the subsilver2 style and edited the code there. You need to add both the class="postimage" to the image and a <a> tag with a rel="lightbox" around the image for the effect to work. Once that was complete, the resizing worked. The lightbox still did not work.

I edited the airbox.js file and added some javascript alert calls to see what was happening. It seemed as though the mootools being used wasn’t working for some reason. AIR-Box uses a free lightbox script called slimbox, so I went there to see what they had. There was a new version and a separate version that used jQuery instead of mootools. I downloaded that version and substituted that into airbox.js. At last I had success.

Published by

Dan

Been a programmer, primarily in the internet space, since late 1997. Google+ Profile

2 thoughts on “AIR-Box plugin for PHPBB”

  1. I’m having difficulty getting Airbox to work on my phpBB forum but don’t follow what your solution is. Can you shed some light on what specifically you did to make it work? My images within the post aren’t scaling down 🙁

    1. I’m going to assume you are not using WP-United as that is not the standard case.

      The problem I had with the resize was the images weren’t being “tagged” with the proper things so the scripts could act on them. I edited the file includes/bbcode.php in my PHPbb directory. I changed the line from:


      'img' => '<img src="$1" alt="' . $user->lang['IMAGE'] . '" />',

      to


      'img' => '<a href="$1" rel="lightbox [slideshow]" ><img class="postimage" src="$1"/></a>',

      If you look closely you’ll see that I took the alt tag off the img tag, but since it only labeled the image as an image, I didn’t feel it was necessary. If you are having the same problem I had, this should fix the resize problem.

Leave a Reply

Your email address will not be published. Required fields are marked *