Saturday, 15 November 2008, 20:16:25 EST
For a while now I have wanted to be able to link photographs from my picture gallery in these posts. The gallery software I use, ZenPhoto, has plugins that do this for packages like Wordpress. Except, I don't use Wordpress. This website is a work of my own. So I had to write my own implementation. You can see it in action in this very post. The picture of footprints in concrete is being pulled from my image gallery and displayed here.
While I was at it, I wrote in some rather nifty features. First, I can request the image to be any size by specifying the width and height I want. The script will scale the image before sending it. The script also caches every image it sends so that the scaling only has to be done once. Second, I can move the image around (to a new album, a subalbum, etcetera) and not have to worry about previously posted images breaking. As long as I have the concrete footprints picture in my gallery, no matter where I move it to within the gallery, it will show up in this post. This probably my favorite feature. As my gallery grows, it becomes necessary to reorganize it from time to time. If I had to go back to all the posts in which I've linked to a gallery image, I would have just not bothered linking the pictures. Finally, the script is able to return information about the image in addition to the image itself. This gives me the ability to dynamically link to the image in the gallery. In this post I merely reference the image. I have not written the hyperlink to the image. That was done after this page loaded (provided you have Javascript enabled).
In all, I think the script is quite handy for anyone who uses ZenPhoto and wants to reference their pictures from outside of their gallery. The script is very much designed to be easy to work with. I wanted it to be usable by other people. You can find the script on my code page. The README file has all of the information necessary for installation, usage, and extensibility.
Categories:
- webdev
- code
- ZenPhoto