Kevin Beason's Homepage > Software > makegallery


By Kevin Beason

What is makegallery?

makegallery is a Perl script that will create a webpage gallery of a given set of images. It requires Perl (already installed on many UNIX machines) and the convert command line utility by ImageMagick.

Here is an example gallery created by this script.


More information

Here is the included README file:

Kevin Beason


makegallery is a Perl script that will create a webpage
gallery of a given set of images (JPEGS).

makegallery can automatically resize large images
by using the "-r xDim yDim" command line option.

SYNOPSIS [ -t title ] [ -l list_filename ]
        [ -x cols ] [ -y rows ] [ -r xDim yDim ] file1 file2 ...

  -t title      Title to use for gallery.
  -l filename   File containing list of images to use.
  -x cols       Columns to use in thumbnail gallery.
  -y rows       Rows to use in thumbnail gallery.
  -r xDim yDim  Display photos using (xDim,yDim) resolution,
                by using resizing.


Copy the included .gif images into a web accessible
folder. Edit and set the $imagesurl
variable to point to the URL of the directory you chose.

For example, if your homepage is:,
you can copy the images into an images directory in your
public_html directory, and then you edit
so that the $imagesurl variable looks like this:

my $imagesurl = "";

Next, if you want to use makegallery without having to type
the full path, place into a directory in your PATH
environment variable.


Place your images in a web accessible directory.
cd into that directory, and then run passing the list of files you want
to show as options on the command line.

For example, lets say you have a collection of 
large photographs from a vacation that you want
to show. This command will resize the images
and create a thumbnail gallery linking to the
resized images:
  ~/makegallery-1.0/ -r 800 800 *.JPG


If after creating the gallery you would like to password
protect it, do the following. These instructions assume
you are using the apache webserver.

Create the password file by running this Perl command:

  perl -e 'print "username:", crypt("password","sc"), "\n"' > .htpasswd
Place this file is in your images directory. Cut and paste the
following into a file called .htaccess in the same directory as
your images, being sure to replace "/path/to/your/images" with
the full path of the directory containing your images and this file.
AuthType Basic
AuthUserFile /path/to/your/images/.htpasswd
AuthName "my_pictures"
require valid-user

Make sure both files are world readable:

  chmod 644 .htaccess .htpasswd
That should be it.

Have fun.

Kevin Beason

Kevin Beason / kevin.beason [] Home