Monday 19 March 2007

Adding some zest to Picasa's HTML export.


Google's Picasa is great for managing your photos. It even has an Export as HTML Page option, which lets you generate a webpage for your photos. But all of the page styles it generates are very simple - if all your photos aren't the same size and orientation, the result is messy.



There are some good web page designs around for photos. Lightbox 2.0 is one, but you have to code all the HTML pages by hand, which is tedious and error-prone.



Picasa lets you generate ugly web pages easily, and Lightbox 2.0 lets you generate good looking web pages with a lot of effort. Wouldn't it be great if there was a way to generate good looking web pages as easily as you can with Picasa?



When exporting from Picasa, you have the option to export the page as XML Code. This isn't very useful by itself, but with an appropriate stylesheet, you can easily transform it to anything you want. I wrote a stylesheet for converting to a Lightbox 2.0 style blog entry.



picasa-to-lightbox.xsl



Because I use this for blog entries, not complete webpages, there are some stylesheet definitions missing from the generated html, along with the rest of the html head section. See the Lightbox 2.0 webpage for details on what is needed.



To convert Picasa's generated index.xml using Xalan, I use the following command-line:



java -cp xalan2.jar org.apache.xalan.xslt.Process -IN index.xml -XSL picasa-to-lightblox.xsl -OUT blogpost.html



Leave a comment if you have any more Picasa tips.

No comments: