Unsung Heroes, Part 1

Web presentation, dirt cheap and fast!

One of the things that makes a series like the "SysAdmin's Corner" possible to begin with is the work of talented programmers the world over. Of course, I would like to take credit for my particular contribution (the writing of the articles themselves). Then there are publications like Linux Journal that provide such a forum. You, the readers, are of paramount importance (thank you ever so much). Still, without the programmers who plug away to bring greatness to Linux through their applications, we wouldn't be having this discussion. The reward for their hard work is sometimes nothing more than personal satisfaction, the pleasure of knowing they have made a contribution.

Some of those contributions are popular and glitzy, commanding a great deal of media attention. Others aren't so visible but nevertheless provide us with useful programs and tools that we can't imagine not having at our disposal. That's what I want to focus on in the next few columns--the unsung heroes and heroines of the Linux and Open Source world. Yes, I am going to showcase some of those tools, and it's audience participation time! If you've got a fave and you feel it hasn't gotten the exposure it deserves, then let me know about it at this e-mail address mailto:mggagne@salmar.com. I'll take it out for a test drive, and if I like it, I'll write about it here. Oh, and if you want a public note of thanks, make sure you include your e-mail address.

Okay, since I brought this whole thing up, I'll start. One of the most useful and fun things I've purchased in the last few years is my digital camera. Specifically, this one is a Canon S10 but your toy of choice may be an entirely different brand altogether. A digital camera frees you to take as many pictures as your heart desires because you are never wasting film. Digital images and the world wide web go hand in hand since the images are stored as .jpg files. I particularly like how easy it is to transfer the images to my notebook. Since the camera uses a Compact Flash card to store its images, I purchased a Compact Flash PC card adaptor--a PCMCIA gizmo that lets me plug the memory module into my notebook's card slot. Then, I use a simple mount command to access the images:

   mount -t msdos /dev/hde1 /mnt/camera

From the /mnt/camera mountpoint, I copy images into a directory on my notebook with the cp command--piece of cake. The next step is for me to create a web page where I can show off all the cool pictures I've taken for friends or family. Sure, I can spin HTML code, create little thumbnails with The GIMP and away I go. To speed things up just a bit, I could do all this at the command line with ImageMagick www.imagemagick.org. In all likelihood, you have ImageMagick already loaded on your system--it's a fantastic collection of graphic manipulation programs. For instance, the identify command will tell you a lot of things about an image.

   $ identify img_1418.jpg
   img_1418.jpg JPEG 800x600 DirectClass 8-bit 152kb 0.1u 0:14pg

While my camera does 1600 x 1200 images as well, I tend to take most of my pictures at 800 x 600 as the identify command shows. To create a thumbnail, I use another part of the ImageMagick package, the mogrify command (I love that name) to generate a thumbnail. Let's work with the above example. On first pass, I copy the image to a thumbnail image name. Then I mogrify:

   $ cp img_1418.jpg thumb_img_1418.jpg
   $ mogrify -geometry 200x150 thumb_img_1418.jpg

Voilà! We have a 200 x 150 pixel thumbnail representation of the image we started with. Want to see that thumbnail with a nice little red border and rotated 90 degrees? We can use mogrify for that too:

   $ mogrify -border 15 -bordercolor Red -rotate 90 thumb_img_1418.jpg

Say you want to create a nice contact sheet with all your pictures, but you want them to be 150 pixels wide, with a 20 pixel gallery quality frame and 10 pixels separation around each image. This time the command is called montage.

   montage -geometry 150+10+10 -frame 20 img_* mypics.jpg

The result of that command gives me something like the following image.

Since we can do HTML without much fuss, we are well on our way to creating a pretty cool web presentation for our pictures. However, setting up that little web slide show can be a tad time consuming even if you know how to do all these things. This is where today's hero comes into play.

iGal is a simple Perl script written by Eric Pop, and it certainly qualifies as a program I cannot do without. If you need to create a presentation of images in a hurry for your web site, for your family or for your company, then you should check out iGal at www.stanford.edu/~epop/igal/. iGal also makes use of the ImageMagick tools we talked about to do its work.

Installing this is child's play since iGal (which stands for Image GALlery generator), being a Perl script, is already source. Still, you can download an RPM or Debian package from their site, which will put the script and its documentation in all the right places. You also can extract the tarred and gzipped bundle and do a make install:

   tar -xzvf igal-1.3.tar.gz
   cd igal-1.3
   make install

To make your instant slide show, change directory to where you already have a collection of images, and type the following:

   igal -xy 150

That's all there is to it. You don't even need the -xy 150 flag I added. What this will do is create an HTML slide show with a title page made up of thumbnails scaled to a maximum of 150 pixels along their longest dimension. In your directory, you'll find an index.html page, your original images, thumbnail versions of these (prefixed with .thumb_), and cross-linked HTML pages for each image. It should look something like the following image.

Click photo for a larger image.

The only real editing that I wind up doing is changing the title of the index.html file. By default, the title for that page is "Index of pictures", and I tend to like something a bit more descriptive. If you would like to see the final product of such a slide show, check out www.transversions.com/wfc/ for moments from the 2001 World Fantasy Convention in Montréal, Québec.

When you run iGal, the default caption for the images is the image name itself. You can change that without editing all the images by running iGal with the -c option. This will generate a file called .captions. Lines in the file will appear something like this:

   img_1282.jpg ----
   img_1400.jpg ----

To create captions for your images, append the text you want to the image:

   img_1282.jpg ---- A picture of me
   img_1400.jpg ---- Mixa on the stairs

Save the file, rerun iGal with the -c option again, and all your pages will have your selected captions. If you choose the -C option (upper case C), you will get your captions, but the image names are preserved. Note that you should then remove the .captions file first.

For the down and dirty of iGal, check out the accompanying documentation, but frankly, it's not much more complicated than this. I will leave you with one final modification you can make to your presentation. You might have noticed the classic film reel effect on the index page. For those who (for reasons unknown) don't like this effect, it can be turned off with the -r flag.

That wraps it up for the first part of this series. Next time around, I'll be checking in on our first reader-submitted unsung hero. Until next time, remember that unless we sing their praises, unsung heroes remain just that, unsung.

Marcel Gagné's new book, Linux System Administration; A User's Guide (ISBN 0-201-71934-7, Addison Wesley) is in stores now (including your favorite on-line vendor). A free excerpt is available on his web site at www.salmar.com/marcel/LSAbook/index.html.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Unsung Heroes, Part 1

Anonymous's picture

Have you tried the HTML gallery feature of gphoto? (The old one, not gphoto2 or whatever the new one is called.) The results are great for posting on the web orburning a CD album. Plus it has a feature I really like that many of these scripts don't have: when viewing the full-sized photo you get three buttons: next, previous, and index. So you don't have to keep returning to the thumbnail (index) page after each photo you look at. Just click next, next, next, etc.

For examples, see

http://home.earthlink.net/~bryantyson/index.htm

all of these photo albums were made with gphoto.

bryantyson@earthlink.net

Re: Unsung Heroes, Part 1

Anonymous's picture

ewebfoto does the job nicely too :-) I love ewebfoto!

Re: Unsung Heroes, Part 1

Anonymous's picture

Another good one is cthumb:

http://puchol.com/cpg/software/cthumb/

Re: Unsung Heroes, Part 1

Anonymous's picture

I like to use Album. Works pretty slick...

Check it out here...

http://freshmeat.net/projects/album/

YAPPA

Anonymous's picture

This is a little PHP script I've made some months ago, you can create powerfull galleries in 1 minute, it's very simple... :)

This is a sample output

Re: Unsung Heroes, Part 1

Anonymous's picture

you can just add an ide.opts file to /etc/pcmcia and your CF card will be auto-mounted where you want it to be everytime you insert it.

Here's a sample ide.opts:

case "$ADDRESS" in

*,*,*,1)

#INFO="Sample IDE setup"

DO_FSTAB="y" ; DO_FSCK="n" ; DO_MOUNT="y"

FSTYPE="vfat"

OPTS="users,uid=501"

MOUNTPT="/mnt/card"

;;

*,*,*)

PARTS="1"

# Card eject policy options

NO_CHECK=y

NO_FUSER=n

;;

esac

This is what I use, and when I insert a card it automagically shows up in /mnt/card

fperez

Re: Unsung Heroes, Part 1

Anonymous's picture

This summer I made a large amount of changes to Eric's Igal. I sent them to him, so he may include them in the future, but in the meantime you can get them from here

The gist of it is that my version can handle 'albums' made up of many galleries (subdirs of images). It handles all the indexing and cross-gallery linking automatically.

I also added a bunch of options, better templating, on-image labeling (good for copyrights), framing, better control for standalone distribution of galleries, .. a bunch more. A changelog is provided.

I also did a lot of work in cleaning up/modularizing the internal code quite a bit. I hope Eric uses this codebase in the future, as I really think it's easier to extend than his original, and less fragile (a lot of things which were copy/paste are now in separate functions).

Re: Unsung Heroes, Part 1

Cmere's picture

I've used the following:

http://www.menalto.com/projects/gallery/modules.php?op=modload&name=News...

It requires PHP, netpbm, and unzip. You can zip your images, upload them, and watch as the server does all the work. It's very well put together, works in PHPnuke, PostNuke, and with custom stylesheets.

Re: Unsung Heroes, Part 1

Anonymous's picture

Here is my version. I think the presentation is a little nicer :)

Re: Unsung Heroes, Part 1

Anonymous's picture

I personally use the netpbm tools for the same job. Then wrap it in a little bash script...

#!/bin/bash

rm HEADER.html

touch HEADER.html

for image in ???-??.jpg; do

jpegtopnm $image | pnmscale -xysize 100 100 | pnmtojpeg > thumb$image

echo "<a href=\"$image\"><img src=\"thumb$image\"></a>" >> HEADER.html

done

-Kurt

Re: Unsung Heroes, Part 1

Anonymous's picture

I have had great success with Album as well. It supports skins/themes so that you can have different looks to your galleries.

Located at http://marginalhacks.com/Hacks/album/

Re: Unsung Heroes, Part 1

Anonymous's picture

Of course, getting netpbm installed requires more than a few other libraries; each less trivial to install than the other.

There's also Gallery: http://gallery.sourceforge.net/

Re: Unsung Heroes, Part 1

Anonymous's picture

This article was VERY useful to me! I had no idea there were CLI tools in Linux for images. This will make image management much more efficient. Thank you VERY MUCH for this article!

Re: Unsung Heroes, Part 1

Anonymous's picture

If this article had been around six months ago I could have saved about 40 hours or work. Thanks.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState