Image Gallery, Slideshow, and Flickr data source for Dojo 0.9
Posted by Shane O'Sullivan on September 4, 2007
In a previous post (see here) I spoke about how I’d written an Image Gallery widget that worked with Dojo Ajax Toolkit version 0.4.2 and 0.4.3. I contacted the good folks at Dojo about updating it for the latest release, 0.9, and adding it to the toolkit.
They were very receptive to the idea, with a few suggestions. Firstly, rather than having its own method of storing information, it should run off the dojo.data API, and secondly, it should go into the newly created dojox.image project.
Both of these suggestions were perfectly reasonable, so, cut to a few weeks later and I’ve finished my first pass at converting over the code from 0.4.3 to 0.9. As the Dojo APIs have changed drastically recently, this was no simple matter, but thats the subject of another blog post.
The code is not finished (or even checked in) yet, but you can see some examples of it running from test pages. There are two separate widgets:
- dojox.image.SlideShow – a simple widget that runs a slide show of images, with urls loaded from a dojo.data store.
- dojox.image.ImageGallery – this wraps the SlideShow widget, adding thumbnail views. This is also loaded from a dojo.data store.
Finally, I’ve implemented a dojo.data store that reads from the Flickr REST APIs, to pull down lists of photos. This store is more complex than the existing Flickr store, as it does caching of results, as well as going against a much more flexible API, meaning that expanding its capabilities later is possible.
Whether or not this goes into dojox or not is still undecided. However, you can see the widgets running using this data store.
See the test files at http://www.skynet.ie/~sos/js2/dojox/image/tests for examples of this working.
Note that this is NOT the final code. It may still be buggy, may look different in the future (it’s pretty basic now), and the code will be cleaned up. However, if you have any suggestions, please feel free to leave comments on this post.