Kyle D. Skrinak

My Spine is the Command Line

by Kyle Skrinak on May.19, 2009, under Technology

I love this kind of stuff. Here’s a simple command line script that will output xHTML gallery of images in a single directory. Requires ImageMagick and zsh.

for i in sponsor-logos/*.*;do
j=`identify -format "width=\"%[fx:w]\" height=\"%[fx:h]\"" $i`
echo \<div\>\<img src=\"$i\" $j alt=\"$i:t\" /\>\<\/div\>
done

Sure I could have done this in php/rails/whatever, but I needed something quick and valid and output that I later use for the jquery “cycle” plugin (which I love, you can see it in use here, look for the cycling logos on the middle right of the page) and this does the trick.

There’s a dearth of documentation on  the jquery cycle plugin; sounds like a blog post.

No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!