Flash-based photo gallery
[03 Feb 2006]
Updated Jun 2011: Unfortunately, something changed in Flash and this gallery is now broken. If I was doing it again now, I’d use a jQuery-based front end for the gallery.
I have been using Coppermine photo gallery on this site for a while now (see the Coppermine version of the gallery: Travel Pix). I have always found Coppermine to be clunky – that is, each new photo requires a new page load and as the photos are loading, the screen jumps all over the place. This is because the pages are based on tables (within tables, within tables). It is not an elegant solution.
There is a “slide show” feature in Coppermine, but the fade-in/fade-out feature only works in IE, not Firefox. The slideshow gives a better user experience than the normal pages, but you can’t see photo titles or photo descriptions as it proceeds.
One possibility I considered was to upload all the photos to Flickr (which has an excellent Flash photo viewer), but this would be time-consuming, tedious and I’m not sure that’s where I want them. And anyway, I enjoy challenges.
I have been toying with the idea of developing my own Flash-based gallery for a while. I looked at several open-source solutions, but I found none of them did what I wanted them to do. In particular, they were not robust for a large number of photos. Also, most of the ones I found did not pre-load images (you would choose an image, then you had to wait – looking at an empty screen – for the image to load before it would appear).
So over Chinese New Year holiday break I got started on a Flash-based photo viewer.
(For comparison with the Coppermine photo gallery, go to Taiwan Photos (Coppermine version).)
How it works
I am using the Coppermine’s mySQL database for the titles and descriptions of each photo. (This was another reason I didn’t want to completely change galleries – all the pix and info are already in there.) The Flash SWF is triggering a PHP file which in turn queries the database. The info is returned in the form:
&filename0="taiwan1.jpg"&title0="This is Taiwan" &description0="It was great"&filename1=...
This is then read by the Flash file and the images with descriptions are displayed.
I did also work on an XML-based solution, but this was not satisfactory for this application since each time there was an update to the Coppermine gallery, I would need to re-generate the XML file. With the current solution, any updates in Coppermine are immediately reflected in the Flash-based gallery. (Update: I realise now I could regenerate the XML on the fly, but too late now…)
Things I will be doing in the Flash version:
Tidy up the interfaceDone – 12 Feb 2006 Fix some timing issuesDone – 12 Feb 2006 Add an option to see full-size images (1000×750 pixels)Done – 4 Jun 2006 Add clickable thumbnailsDone – 4 Jun 2006 Add an option to view other albums within the Coppermine galleryDone – 4 Jun 2006
- Attempt more efficient loading from the PHP file (This appears to be working fine – no need for further action)
It should keep me out of trouble… It did keep me out of trouble!
Update (4 Jun 2006): Finally this is finished! The clickable thumbnails were not that hard to do, but added a lot of complexity to the button behaviour. The buttons need to be ‘inactive’ when fadein.fadeouts are occuring, else loading errors would occur.
Moving the thumbnails was another interesting exercise. I wanted to have a smooth movement (which I achieved) but I had to abandon it when it was all put together – it just had too many possible user inputs and getting one thing to work meant 3 other things would break. Anyway, I feel the overall effect is still much more pleasing than Coppermine.
I decided on a PHP-based solution for choosing albums by clickable thumbnails. A Flash-based solution for this would have taken a lot longer, and not been any better, I felt. My gallery chooser also allows for restricted view galleries, also based on Coppermine’s restrictive view system. That bit was fun – the login info is passed to the Flash file via a GET so that when the user clicks to go back to the PHP album choice page, they are still logged in.
[It's a shame it's broken now! One day if I have time, I'll fix it...]