Log in

No account? Create an account

Imagery - Musings of Unayok

2009 Jan 15


Previous Entry Share Next Entry
Well, though it's probably not entirely ready, and the metadata/descriptions certainly aren't, I went ahead and switched over my photo gallery to my new custom special generator. Then added a few hundred more images. Then went back and fixed most (probably) of the now-broken links and embeds in the old journal entries.

I'm considering releasing the code for this, because I'm rather proud of its speed and its flexibility. I want to do some restructuring first; I have some longer term goals. Being able to point at a public site with an GPL'd app might look okay on the CV too. Hehe.


[User Picture]
Date:2009 Jan 17 - 15:59 (UTC)
I'd love to see this in action.
[User Picture]
Date:2009 Jan 18 - 01:15 (UTC)
Well, the best demo site (the only demo site) is my gallery.

This is with the templates I've created. The templates are sufficiently separate from the underlying script that they can be replaced with something else, but I do rather like the simple and fast pages generated by my first bash at default templates.

The script basically works by having two directory structures: source and target (though of course you can name them whatever you like). In the source directory, you build the structure of the gallery, using sub-directories as far down as you like for sub-galleries/albums. you can put image, audio and video files in any of the directories. WHen you run the script, it generates thumbnails from the images, and all sorts of linked html files in (and copies the originals over to) the target directory. it detects when no changes have been made to an image or a directory and avoids useless regeneration.

Each file in the source tree can have a properties (meta-data) file (image-name.jpg.properties) to give specific extra information, like titles and descriptions. This could be tracked in the image EXIF headers, but it's much simpler for me to do it in separate files at least for now.

Similarly, each directory can have an album.properties file that provides the same sort of information (title, subtitle) as well as useful stuff like determining the sorting order for the items in the directory. A sample "sort-order" property would be "+weight,-date,-name" which sorts in ascending order by "weight". For files eighted the same, descending date order is the next sort term, etc etc. "Weight" is nothing more than a property in the {image.jpg}.properties file.

There's no UI or web interface. You maintain the gallery meta-data/properties and structure using your favourite text and image editors, as well as file manager. when you're ready to generate your static gallery you just run a simple command

terbium.py {sourcedir} {targetdir}

and sit back for a bit.

The last feature added was a more techie one. On Unix-like file systems, you can create shortcuts/symbolic links, allowing a file or directory to apply in more than one place, but not have to duplicate the data. The script now handles this. Files appear as if they are actually in the linked directory, links to other directories get shown as "see also" entries.

Lost you yet? If you look here you'll see an example of the linking. Every image in that album actually exists somewhere else. Click on one, and you see the page for the image, with a link to the "source" (mostly Baycon 2005 in this case). In addition, though, there's also a "see also" section with links to other directories housed under Baycon 2005, but which are also relevant here.

I probably could fairly easily add in explicit shortcut files or properties for non-Unix implementations. Like XP/Vista. They actually can do the same sort of thing, but it's not really the way that they like dealing with files. actually, I have no idea how well or poorly the script will run under Win*... I wrote it to scratch my own need for a gallery... Tracking several thousand images is somewhat daunting...

And I'm rambling, so I'll shut up... At the simplest, it's a script/app that takes a directory of images, and builds a static html gallery from it.


Edited at 2009-01-18 01:15 am (UTC)