I have finished up Portico version 0.6.
Most important is the addition of a pluggable URL mapper to get to the resized and/or thumbnail version of the images. This was essentially Walco's idea, although I'm not even sure he'll be using it :) Thanks anyway!
I also implemented a verify_installation function that can do simple validation of a user's setup for Portico. I know of one other user of Portico. He suggested some additional documentation regarding the CSS styles used by the default templates.
Its nice to get feedback!
Changes since 0.5:
- Implemented a verify_installation function to check to validate the portico_url_mapper configuration option, if set.
- Added support for pluggable URL mappers for URLs of resized and/or thumbnail versions for the images.
- Some documentation updates.
Portico has just been added to the Pyblosxom plugin registry!
Frankly, I'm quite fond of that. This is my first 'publically available' and released - albeit small - piece of software. Out of the number of attempts to write something useful (anyone say Foobees? :) I got Portico in a usable and documented state.
Plans for the near future:
- Follow Walco's suggestion and introduce the concept of a configurable URL mapper. This could be used to map the URL pointing to an image to the URL of the thumbnail or resized version of it.
- Do something with EXIF metadata.
- Write some smaller tools for generating the .port files. This is probably connected to the second bullet point.
- Finish up and release (in some way) the exifarchiver tool. And there's probably a way to integrate that with the previous point.
Portico is a Pyblosxom entry parser plugin for displaying small to medium size photo galleries as a single blog entry. Portico blog entries are displayed in three different ways, depending on the context:
- Displaying short series of thumbnails, whenever the entry is not individually rendered at its permanent URL (e.g. on the front page of your blog, amongst other entries).
- Displaying all the thumbnails for the collection, whenever the entry is rendered at its permanent URL.
- Slideshow-like, displaying a larger version of the photo, possibly including 'next' and 'previous' links to navigate though all the previews of the collection.
It parses and renders blog entries that have a .port file extension. The Portico blog entry file format is different from most other Pyblosxom entry types in that it follows the simple '.ini' style syntax.
Each entry file is required to have one section called entry, with one required 'option', called title. Example:
[entry] title: A small photographic report on my visit to Timbooktoo
The entry section recognizes two other options: thumbnails and cherries. The first depicts the number of thumbnails to display whenever the entry is not rendered at its permanent URL. The cherries option allows to specify what thumbnails to show in a space seperated list of thumbnail numbers.
Every image in the gallery has its own section in the file. Each of these sections requires two 'options', image and thumbnail. Example:
[photo_1] image: http://foo.bar.com/path/to/image.jpg thumbnail: http://foo.bar.com/path/to/thumbnail.jpg
The displayed images are sorted on the section's title. At the current stage, the section's title is not displayed. This may change. See also TODO.txt
Portico will not create thumbnails nor preview nor resized versions of the photos for you. At least not this moment. Who knows.. maybe it will at a later stage.
Portico is at an early stage of development. It most probably still contains bug here and there and its functionality might not suite anyone at all. Feel free to send questions, ideas, patches or any other feedback to jw at n--tree dot net.
There're at least two ways to install the Portico plugin:
- Copy (or link) the portico.py module in the plugins directory of your Pyblosxom installation
- adjust the py['plugins_dir'] configuration option in the config.py file of your Pyblosom installation to include the directory containing the portico.py module.
If you're using the py['load_plugins'] configuration option, you probably know that in order for the Portico plugin to be usable, it needs to be listed there.
After installation, you can start to write blog entries with the .port file extension. Apart from being photo galleries and the specific file format used, Portico entries behave like any other blog entry type.
There're currently six configuration options recognised by the plugin:
- py['portico_thumbs']
- To set the number of thumbnails display, whenever the entry is not rendered at ot permanent URL. This number will be overrided whenever an individual entry has the thumbnails or cherries metadata field set.
- py['portico_single_image_template']
- The template used for rendering one individual image. The following four variables are recognized for interpolation: prevlink (the URL to the previous image in the gallery, or an empty string if we're at the the first), nextlink (the URL to the next image in the gallery or an empty string if we're at the last), backlink (the permanent URL of the entry) and imagesrc (the URL for the image being displayed).
- py[''portico_gallery_main_template']
- The template used to render the entry displaying the thumbnails in the gallery. There's two variables that are used for interpolation: thumbnails, used to interpolate the sequence of thumbnails and morelink that is interpolated with the result of the portico_more_thumbnail template.
- py['portico_more_template']
- The template used for the more link. There's one variable used for interpolation: morelink, which is the permanent URL for the gallery entry.
- py['portico_thumbnail_template']
- The template used for rendering one thumbnail (and thus is repeated for each of the thumbnails in the sequence). There's two variables used: singleimagelink and imagesrc. The former is the URL that will render the single resized image. The latter is the URL for the thumbnail.
- py['portico_url_mapper']
- Either an (importable) name or the factory function for a URL mapper.
The optional, pluggable URL mappers are used to determine the URL to the thumbnails and resized versions of the images referenced in the .port file. If there's a mapper configured, the thumbnail key in the image sections in the .port file is ignored. Instead, the image key is used and passed as an argument to the thumbnail() and image() methods of the URL mapper. These methods should return a URL.
The portico.py plugin module contains an example of a simple mapper implementation. The image() method will just return the URL unmodified. The thumbnail() method will replace any occurence of resized in the URL with thumbnails. This mapper is compatible with the galleries generated by the gallery2.py script.
You can see Portico in action in the author's blog.
- The author's blog
- The TODO.rst.
- The portico.py python module. It contains some smaller explanations and of course the plugin source code itself.
- For the latest development version, check the Subversion repository.
- Display more information/metadata about images.
- Extend number of recognized options for the entry section and image sections. E.g. certain EXIF tags or DC like metadata.
- Allow sorting of the gallery images based on other elements than the section's title.
- Small toolset to generate entry files.
- Look at ConfigObj
- Render thumbnails and preview versions of the images files on the fly.
The photo-gallery-blog-entries plugin for my Pyblosxom blog is somewhat complete! I found a nice name - Portico - and wrote some documentation for it.
Now for releasing it to the world of Pyblosxom plugins!
There's still lots of possible features to implement.
And I shouldn't forget to mention Walco and thank him for testing the various stages of development.
The contents of the entry file for the test gallery looks like this:
[entry] title: Test gallery [dsc_3655] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3655.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3655.JPG [dsc_3661] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3661.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3661.JPG [dsc_3664] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3664.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3664.JPG [dsc_3665] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3665.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3665.JPG [dsc_3672] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3672.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3672.JPG [dsc_3674] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3674.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3674.JPG [dsc_3675] thumbnail: http://jw.n--tree.net/galleries/vienna/thumbnails/DSC_3675.JPG image: http://jw.n--tree.net/galleries/vienna/resized/DSC_3675.JPG