The Gallery

It took me a while, but I found one. A simple PHP based gallery system, that uses XHMTL and CSS for the layout.

If only I’d googled “Simple PHP Gallery” in the first place I might well have found it at my first attempt. Because its called just that — and it comes from relat­ively­ab­so­lute.

The only pictures in there at the moment are some from a trip to Bringewood in July of last year, that I was using to test it all out. I guess I’d better get a new digital camera to fill it out a bit then. Canon Powershot A85 anybody? Update: Its entirely possible that I’ve just ordered that very camera…

Right, non geeky readers can stop reading right about now and go look at the pictures…

The Geeky Bit: Implementing SPG

Still with me? Good.

Installing SPG is dead simple. Download the .zip file, extract it, and then upload that to a folder on your website. As the system is so very very simple, its dead easy to custom­ise it to fit in with your site aswell. Just alter sp_index.php and sp_styles.css to suit.

The hardest part came about because I’m using a fixed width template on this site. Left to do as they pleased, images that were wider than the site quite simply broke it. So I decided to set a max-width on the images, then let the user click on them if they wanted to see them full size. Easy enough, or so you’d think. Just set the max-width in the CSS file and alter sp_index.php to put a link around the image. No problem.

That is to say, no problem until we come to test it in Internet Explorer. IE doesn’t actually support max-width does it? JavaScript to the rescue then.

With a bit of help from the peeps on the SitePoint forums, I knocked up a simple little script especially for IE, that figures out if the image is too big and scales it appro­pri­ately. You can find it in the head portion of the gallery pages.