Here’s a helper I just wrote for a site of mine. I use it with my picasa XML albums to generate the appropriate links for Lokesh Dhakar’s lightbox image viewer trick. You can change it to use your own image views by simply changing the "slideshow" method in the helper.
It is also a good example of parsing an XML resource in ruby. I am parsing most of the metadata so you should be able to do a lot more with this.
In the controller, you need to add the following:
In your .rhtml file, add the lightbox tags:
Finally, add picasa_album_helper.rb to the helpers directory.
Let me know of your experiences with this.
Update 06/23/2006: I got a patch for this not too long ago. Still waiting for confirmation before submitting it but I did add it to the subversion – see the repository browser for a version history.
I found your class while looking for a way to parse the xml from Picasa and write an html template-based generator. I already had a working proof-of-concept written in ruby, so I kind’a had to restructure it heavily. I did modify the class to add some missing tags that I needed, but the biggest change was to add a hash with each tag. I use the hash to substitute the tokens in the html templates for the data in the xml. I stil lleft your class vaiables just in case I ever need them. I wish there was a cleaner structure for this; it’s raw but works.
I put the scripts in my homepage under Linux/Projects if you’d like to peek. I’m new to ruby, being this one of my first scripts, so I appreciate any critic. I feel like I learned some more exciting things of ruby in practice, by studying and using your class. Thanks! It was most refreshing.
Thanks for your comments. This is why we write open source, to know it was useful to others, and when you get comments from people you know your efforts aren’t in vain.
I’m pretty new to ruby myself (although have been using scripting languages on and off as support code for more “format” languages for years).
Now that Google has released picasa for linux, I’ll probably get a lot more input from the script than I would have under the Windows days. Someone already submitted a few changes to it (I’m waiting for confirmation from him before I change the one in version control).
Anyway, thanks again for the comments and I’m glad it’s been useful for you – muy buenas fotos, por cierto.
can you help me with an example to the “url_for( “/path/to/album/index.xml”)” … has picasa changed something … I can not find this index.xml-Link !!!
Comments are closed.