Integrating slideshowpro with galleria using php
The other day a friend of mine, Scott tweeted about getting slideshowpro to work with galleria. As someone who is usually up to a little coding challenge from time to time, and not knowing anything about slideshowpro nor galleria, I challenged myself to get it working with his wordpress setup.
Does anyone know if there is a way to make Galleria (JQuery) work off of a SlideShowPro XML file?
I started researching slideshowpro, and I knew that is used XML based feeds into the flash SWF’s that they use, but what I didn’t immediately know, was that the XML it produced was dynamic. I set off coding some simpleXML stuff in php, based on an XML file Scott had cached on his server. Once I got that working with galleria, I started to tackle the DirectorPHP API.
I knew Scott uses the Thesis theme on his site, which is capable of including php files, outside of the normal wordpress stuff, without resorting to plugins. So once I got my php code working as a standalone page, all
he’d I’d have to do is a few tweaks, and then include it in Thesis.
- A working slideshowpro director environment on your server
- You’ll need to download the slideshowpro “accessory”, the DirectorPHP which requires PHP 5 and cURL module
- Lastly, you’ll need to download the Galleria files
- The ssp2galleria.php file from here
In the root of your website, create a galleria folder. You do not have to use the root folder, but the php code I will describe it based on that. Before uploading the DirectorPHP files, open the classes/directorAPI.php and enter your slideshowpro api-key and api-path in the file.
Put the ssp2galleria.php, which I will explain later, the DirectorPHP classes directory, and the galleria files and directories into that directory.
How it works
Using the slideshowpro DirectorPHP class, the ssp2galleria.php generates the img tags that galleria is looking for. If you pass in the albumID into the page,
it will display that album ID. If you omit the album ID, it will make a list of all “live” and “published” albums, and make a clickable galleria slideshow from that.
If you try to get crafty and pass in bogus album ID, it has a default album ID to fall back on.
*Note – The watermarking feature in slideshowpro’s flash based shows doesn’t translate to galleria. So, if you want watermarks, you’ll have to have them on the source image.
I hope the comments in the code are enough to get you going. Most of the changes you’ll want to make are more in the galleria customization, and the associated galleria css files. If not, leave me a comment, send me a tweet, or email me and I’ll try to help. However, I offer no warranties, nor promises…
And now, the guts of the ssp2galleria.php.
This really only uses some very basic galleria customizations. Galleria is really much more configurable, and using the techniques above, you can pretty much get the DirectorAPI to deliver whatever content you need to supply to galleria. You can find out more about the slideshowpro DirectorPHP class, on their wiki.
You might also want to integrate a concept like this into WPTouch, which would fairly easily let you keep your spiffy flash based slideshows for “full” web browsers, while delivering the galleria based slideshow to “mobile” browsers.
Oddly enough, last week, on my commute, I was listening to episode 148 of the This Week in Photography (TWiP) podcast, and Frederick Van Johnson mentioned that he wished there was a non-flash based way of displaying slideshowpro content. Well, here you go…
Simply wondering how I got that “tweet” to display above? Head over to twitter’s blackbird pie…
If you found this information valuable, please consider a donation. I don’t drink expensive coffee…