AJAX Photo Gallery (ajaxpg)

Currently at version 0.2.

ajaxpg is small (one JS file, one CSS file) infrastructure from which you can create a dynamic image gallery, or collection of galleries.

How it works

You need only include the requisite CSS/JS file in your page (take a look at the sample galleries). When the page is visited, the script will look for a file 'apg.js'. This JSON file contains a list of gallery locations (other JSON files with the same format), a title of the gallery, a representative thumbnail URL for the gallery, and a list of photo objects, each of which contains a title, a url, and a thumb (thumbnail URL).

Generating Galleries

The JSON required for a gallery definition is simple enough that small galleries can be managed by hand. For larger galleries, it's probably a good idea to generate galleries dynamically. If you use Qdig, or more specifically, my hacks to Qdig, there is an add-on that you can install which will generate the apropriate JSON for you. You will need to add rewrite rules however, such that the web server calls the script for apg.js.

Alternatively, ajaxpg is useful as an RSS aggregator for media feeds. apg-rss requires simplepie, and will convert RSS feeds into the appropriate JSON. Again, rewrite rules are useful here. To generate RSS feeds, you might be interested in mkphotorss which is a perl script that takes stdin and generates an RSS file.



ajaxpg is not without limitations in its early release. It …

  • currently suffers from general AJAX bookmark/back-button issues.
  • is not a stand-alone solution; photos must be hosted somewhere.
  • currently is not asynchronous.
  • does not work on older web browsers, such as MSIE6.




If it's not asynchronous, and uses JSON, why is it called AJAX PG?
It's synchronous to maintain the order of galleries (we can fix this in a later release), and uses JSON because it's easier. It does work with XHTML, which is XML. It also uses Javascript. AJAX is also buzzy. It has synergy and is the currently shifted paradigm. Web 2.0.