Make your own free website on
My Photo Gallery  3.2

Please read everything but email me if
(1) you do not understand
(2) you get it running (so I can check it out and put up a link to your site)

In this README:
  • 1. web server (tested on apache Linux/Unix but reported to work on Windows NT/2000)
  • 2. Perl 5.00503 (may work with others)
  • 3. ImageMagick (with PerlMagick) 5.2.2
  • 4. Image::Info and IO::String (to get EXIF data stored in the images by digital cameras).
    NOTE: if you do not have root access to install these perl modules, just follow the easy instructions in README.IMAGEMAGICK to install them locally.
    My Photo Gallery is a Web-based photo gallery with support for other filetypes. It is easy to setup and even easier to maintain. Slick-looking image/file galleries and thumbnails are generated on the fly from the directory that you specify. Creating an album is as easy as creating a directory and FTPing your pictures to that directory. A Web administration interface is available, and updating is just as easy. It also includes advanced features such as image logging, resizing, extracting EXIF data from digital cameras, and visitor comments. Many other file formats are recognized and given a special icon.
  • Automatic creation of photo,movie, and file galleries
  • Separate directory for thumbnails, resizes, and other data leaving your original source directory clean (and can be read-only)
  • Web based upload and gallery manager
  • Automatic unzip'ing of uploaded .zip files (requires 'unzip' to be installed and in your path)
  • Uses a template.html file to quickly make everything match your current site
  • Simply ftp your stuff or use the web based manager
  • Pretty file name option (in config file)
  • Automatic thumbnail generation
  • Automatic creation of various sizes of each image so that your visitors can specify the viewing size of their preference.
  • Logging for each time a picture or album is viewed.
  • Visitors can comment on each picture.
  • support to allow your visitors to order prints.
  • Manage your photo galleries from the web.
  • Previous/next picture buttons with thumbnail preview
  • Automatic extraction of EXIF data embedded from most digital cameras
  • Easyily themable with your custom colors, logo, and main page
  • Configurable filetype support to support any filetype for download
  • Upload, rotate, or delete images using the web manager interface
  • password protect directories using a lock file of user/pass's
  • I am sure there is more that I cannot think of.
    This software is released under the GPL. Please see the included LICENSE file. Copyright (C) 2000 Michael Spiceland This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Use this script at your own risk! I make no warranties that it is hack proof!
    IMPORTANT: You must have the perl modules listed in the requirements section before this script will work. Even if you do not have root access, you can install them locally using the instructions in docs/README.IMAGEMAGICK. Read the doc/FAQ.html or Intro to CGI at to easily troubleshoot it.

    1. Install scripts
    This script will need three directories.  One is for the cgi scripts, one is for the main source images that you want a gallery of,  and the third is a data directory to store the thumbnails, resized images, comments, and descriptions.  By using a separate directory for the data, your original photos are left untouched.  The original photos are only read, never written to.

    Here is what I use:
    /home/username/www/cgi-bin/photo/ (to store all the script stuff)
    /home/username/www/photo/ (to store all of the images for display)
    /home/username/www/photodata/ (to store thumbs and other data)

    For example, this is what I do:

    ftp myphotogallery.tar.gz into my www/cgi-bin/
    tar -zxvpf myphotogaller.tar.gz
    cd photo/
    mkdir /home/username/www/photo (to be the main directory for the galleries)
    mkdir /home/username/www/photodata (to be the data directory for the galleries)
    mv site-images/ /home/username/www/photodata/

    One of the most common issues when installing "My Photo Galley" has to do with permissions.  The web interface in the next step will point you at how to use the manage.cgi script to check some of the most common errors.  If this doesn't work or you get an internal server error when you attempt to run the manage script, please check the docs/FAQ.html included in the package.
    2. Configure My Photo Gallery

    Using the web interface

    If you followed the instructions above, you can use the manage.cgi script to check for all of the requirements and set up all of your variables.  Simply point your browser at:

    Using the web interface you can:

  • verify you have the dependancies installed
  • set-up and configure your configuration/variables
  • manage/edit photo galleries
  • find out more information on included too

  • If manage.cgi has problems finding your local Image::Magick install then you may need to use a use lib line at the top of the index.cgi and manage.cgi script.  More details are below in the manual section.

    Editing the config file manually

    Edit (in the cgi-bin/photo/ directory) to suit your needs. You will need to make sure the directories chosen in the two above steps are in this file correctly.

    If you had to install Image Magick with NON-root permissions (the work around described in the README.IMAGEMAGICK) make sure you add the use lib ""; line to both index.cgi and protected/manage.cgi. I use the following two lines at the top of both scripts:

    use lib "/home/username/www/cgi-bin/local/lib/site_perl/5.6.0/i686-linux/"; #ImageMagick
    use lib "/home/username/www/cgi-bin/local/lib/site_perl/"; #Image::Info and IO::String

    You can easily change the entire look of your galleries. There are a few basic ways to change the look:

  • modify the colors in
  • upload a new logo to site-images/ and specify it in
  • upload new buttons and images by simply replacing the old ones in site-images/
  • update the news.html (your frontpage of the gallery) to look as you want.
  • 3. Create your photo galleries

    Setting up your galleries

    Use the manage.cgi script to upload your photos and .zip files.  Alternatively, you can keep reading for information on how to manage your galleries manually.
    Now you need to mv or upload your pictures into directories under the directory created in the step above. For example, if you use the directory mentioned above you could make a directory /var/www/html/photo/florida2000/ and then put all the pictures from the florida trip in that directory. You can make as many of these directories as you like. I will from now on call these "albums".

    When My Photo Gallery is normally run, it creates the thumbnails, different image sizes, and required data in the data directory "on the fly".  This is useful for those with limited space but requires your webserver to "crank" a bit making the different requested sizes the first time that size is accessed.  Alternatively, there is a really slick script called ./ included with this package.

    If you want to create all of your thumbnails and/or resized images before-hand instead of dynamically the first time someone clicks on that size image, you can use the script included with this application. That script will create all of the files that haven't already been created. It will take a long time the first time it is run, but after that it is quick.

    To run it, simply run:

    some options for fine tunning:
    -c config_file (to specify a config file if it cannot find it, e.g. cron jobs)
    -s size,size,size (specify more than just the default of thumbnails and 640)
    -q quite mode for running in a cron job .. this mode doesn't ask you to verify anything

    ./ -s 320,640,800
    This will create thumbs and the three specified sizes.

    ./ -q -c /var/www/cgi-bin/photo/
    This is a good way to run the script nightly with cron. It runs in quite mode without asking for any input and is given the full path to the config file since cron cannot use relative paths.

    Password protecting your galleries

    If you want to password protect a directory, you will need to manually put in a lock file. This file should be named 'lock' and be placed in the directory that you would like to password protect. It should contain the username and passwords for any users that you want to give access to, one per line with username=password. For example, if you want henry to have access using the password 'oranges' you would put


    in the file 'lock' that is in the directory that you want to deny access for. Please be carefull using this feature as it is not gauranteed to prevent access although it is secure enough for almost all uses.

    IMPORTANT: You should use htaccess or some other method of password protecting the protected/ directory. If you not know how to do this, please ask your server administrator to password protect this directory for you. If you choose not to do this PLEASE remove this directory. manage.cgi is a script that you can use to manage your photo galleries. It is not secure enough to allow public access to it. Many accounts have a web interface that will allow you to do this. IF YOU CHOOSE TO LEAVE THE MANAGER.CGI ON YOUR SERVER, PLEASE DO SO AT YOUR OWN RISK AND MAKE SURE IT IS PASSWORD PROTECTED.
    5. Your done!
    Fire up your browser and point it at the index.cgi script. Good Luck! Email me if you use it!

    Just point your browser at it


    If you get an internal server error, run it from command line so that you can see what is going wrong. See my docs/FAQ.html on my script page for more info.

    You may also use the web based administration (if installed) by pointing your browser at:


    11.23.2000 Initial release.

    11.28.2000 Added commenting section and a few new settings in Added a few more images to site images. Fixed back button to work even after comments.

    11.28.2000 Fixed space in filename issue (hopefully) there were many bugs here to squash. Changed location of descriptions to descriptions/ sub directory under the album. This is more organized.

    11.29.200 MAJOR changes. Added manager.cgi in protected/ and all of its features Added support. Added many new variables in Added wrapping if the number of albums goes over the albums per row variable.

    12.03.2000 fixed bug when reporting the height to shutterfly. fixed a few bugs and enhanced security in manage.cgi (I still think manage.cgi should be as proetected as you can make it in order to be safe)

    12.08.2000 Changed to version 1.4. Added prev/next links and thumbails for prev/next. Added width tag on preview images. Changed image to a border table with rows. Removed the exact timestamp from the images.

    12.19.2000 Changed to version 1.5. A few asthetic changes including a smaller date on each file in the album. Added check for empty directory name. Moved the directorycheck() sub to so that I could add it to the manage.cgi. manage.cgi now also creates thumbnails that were unavailable before. Added README.IMAGEMAGICK

    12.30.2000 Added a link to the index.cgi to the manage.cgi. Added maxWidth viewing option for visitors. Added a cookie to store the users viewing preference. Changed background color and updated corner pictures.

    1.10.2001 Major update to appearance. Added search.

    1.28.2001 Version 1.8 Added support for movies. Still need to fix comments for movies.

    5.27.2001 Version 1.9 Added email option for commenting. Fixed movie commenting.

    6.11.2001 Version 1.95 Fixed issue where pictures with caps extention (.JPG) would not show up.

    7.17.2001 Version 2.0 Added subfolder support. Also updated the manager to support subfolders. Changed the sorting of the folders. Using ping now to get the resolution of the images instead of having to open the image first (much faster).

    7.22.2001 Version 2.01 Fixed the picture size returned from the 5.3.6 version of image magcik when using the ping command. Added a new variable called $old_imagemagick to sitevariables to specify which image magick you have installed.7.22.2001

    8.2.2001 version 2.02. New images for folders, buttons, arrows, etc. Added comments to teh colors section of the setup to make it easier to see what you are changing. Made the text color variable actually work and change the color of the text in the menues.

    8.4.2001 version 2.5. Complete overhaul of the way the script works. Re-wrote the album display routine. Better support for any filetype. You can now register filetypes using the %filetype hash in the file. Also re-did the standard images used for buttons,logos, etc. Also a complete overhaul of the manager script! Added support for Image::Info to get the EXIF data stored by digital cameras.

    8.10.2001 version 2.6. Major security fix! Now it dies if someone puts .. in the album name they want to view! Fixed deleteing a picture to delete the picture and all different sizes of it (manage.cgi). Fixed problem with spaces in image names for older netscapes. Added alpha watermarking code.

    6.12.2002 version 3.1. Major updates: My Photo Gallery is now much more customizable thanks to the use of a template file. Using this file, the photo gallery is generated inside an html page at the point where you specify. This makes it really quick and easy to make the photo gallery match the current site. added a smaller viewing option for all pictures of 320 pixels in width. Took off the main menu on the right side. Added option to turn off the shadows around each picture. New png images for directories to allow for any color background that you wish. Added password protection for any dictory where you want to require a username and password. No longer using Image Magick's ping function to prevent incompatablities between versions.

    3.6.2003 version 3.2 Major updates: Complete re-write of the manage.cgi script.  Users can now easily update the config file through this web based interface.  New manage.cgi now acts in batch mode, allowing an entire directory to be processed at a time with description editing, rotation, deletion, and more.  Automatic unzipping of uploaded files when using manage.cgi.  New version fixed many bugs.  Main index.cgi has many cosmetic changes.  Picture table now tightly holds all generated information in a smaller table, buttons accross the top have been streamlined.  Package now includes a command line script ( that is capable of doing all of the processing ahead of time for the script instead of waiting to do this dynamically.

    I need to do/need help with the following items
  • 1. disable right click to save with java script
  • 2. add rename to admin script
  • 3. add viewing of thumbnail of image while typing comments to admin script
  • 4. fix shutterspeed bug with shutterspeeds over 1 sec.
  • 5. allow the creation of the username and password lock files via the manage.cgi script
  • Send questions or comments to

    Michael and Erin
    FuzzyMonkey scripting wizards