anders.com: projects: webgallery: install
overly verbose installation instructions
[ home ]
[ anders ]
[ resume ]
[ choppers ]
[ projects ]
  [ netatalk ]
  [ route66 ]
  [ javascript ]
  [ webgallery ]
    [ download ]
    [ install ]
  [ mockMarket ]
  [ merits ]
  [ dailyBulletin ]
  [ panacea ]
[ words ]
[ pictures ]
[ movies ]
[ contact ]


Save Anders' Savings!
if your system doesn't have shared jpeg libraries, download jpegsrc.v6b.tar.gz (mirror) and untar.
    tar -xzvf jpegsrc.v6b.tar.gz
    cd jpeg-6b
    ./configure --enable-shared
    make
    make install
    
download ImageMagick-5.3.5.tar.gz (mirror) and untar.
    tar -xzvf ImageMagick-5.3.5.tar.gz
    cd ImageMagick-5.3.5
    ./configure
    
make sure ImageMagick has found your JPEG library. near the end, you should see a line like this:
    JPEG              --with-jpeg=yes               yes
    
a slight error in the sourcecode exists in ImageMagick-5.3.5 which makes it not be able to be compiled out of the box, so we'll fix that here:
    cd magick
    ln -s fonts.h font.h
    ln -s fonts.c font.c
    cd ..
    
now we can build ImageMagick:
    make
    make install
    
for some reason, the automatic build of PerlMagick doesn't work either. as we will be needing this, we have to do that by hand as well:
    cd PerlMagick/
    perl Makefile.PL
    make
    make install
    
now our environment should be set up. let's install webgallery and test it out. download webgallery and untar and install:
    tar -xzvf webgallery-1.2.tar.gz
    cp webgallery /usr/local/bin
    
(you will need to have /usr/local/bin in your path to be able to execute webgallery without giving the full system path. most paths should already be set up this way.)

try webgallery without any options to see if it finds the perl module. (you may need to rehash first)
    webgallery
    
if webgallery comes back with the usage line, that means things look good. if not, go back and check your PerlMagick install for errors.

go to a directory tree that contains pictures. i like to keep my pictures in date order. directories named the year (2000 or 2001) contain subdirectories named month-day-description (05-03-tahoe_trip or 12-25-christmas_party) which contain all of my pictures named number-discription.jpg. (03-anders-camp_fire.jpg or 21-helicopter_landing.jpg) i tend not to use spaces in directories or filenames, although spaces are supported by webgallery. let's go to the directory that contains the year directories (called the picture root) and try this thing out. first we will need a template.inc file. a sample template.inc is included in the distribution, so let's copy that into the picture root and try the program.
    cp template.inc /wherever/you/have/your/pictures
    cd /wherever/you/have/your/pictures/
    webgallery 2001/05-03-tahoe
    
if all goes well, you should see webgallery ripping through each picture in the specified album. after each image, you will see a strange little set of characters displayed: (this means things are going well)
    converting: 2001/05-03-tahoe/01-lake_tahoe.jpg [rswsw]
    
"r" stands for "reading", "s" stands for "sizeing" and "w" stands for "writeing". webgallery first reads the origional image in, then sizes it to make it's maximum resolution (height or width) 800 pixels (by default) usually this means you get an 800x600 or 600x800 image. then webgallery writes that image (called the small jpeg) adding "_sm" to the end of the filename. then webgallery sizes the maximum resolution down to 64 pixels for the thumbnail version of ths image. then this image is converted and written as a gif file.

after all the images in the album are converted, webgallery looks for a file called template.inc and uses that to write an index.html file. if an index.html file already exists, webgallery will ask before replaceing it. then webgallery will walk up the directory tree createing or asking to replace the index.html files. (in our example, this means after creating 2001/05-03-tahoe/index.html, it will create or replace 2001/index.html and then index.html) these higher index.html files will consist of a listing of links to all the directories that contain an index.html file.

a few notes about template.inc files:

whenever webgallery needs a template.inc file to create some html, it looks in the current directory. if no template.inc file exists there, it goes up a directory until it finds a template.inc file or it runs out of directories to search. this way, you can have differient template.inc files for differient levels within your photo albums tree.

webgallery is designed to make the html easy to edit. if you look at the template.inc file, you will notice that it is straight html except for the occurance of @@title and @@body. these tokens get replaced with the apropriate html by webgallery. @@title is a text string built from the directory name, and @@body, in the album context, gets replaced with a table with all of the thumbnail images and links. in the index context, @@body gets replaced with an un-ordered list of links to all of the directories that conatin index.html files. feel free to play around with the template.inc file to suit your needs.

as you add photo album directories and re-run webgallery, make sure you always run webgallery from the same directory. if you don't do this, you will get inconsistant titles and index.html files.

webgallery has several customizable defaults such as small jpeg max resolution size, and thumbnail max resolution size. edit the webgallery script and change these values at the top of the script. other values are editable, such as the number of thumbnail images per row. (default 4)

to report success with webgallery, send an email to the address at the bottom of this page and place a link to webgallery on your website where people will notice it. sample link code:

<a href="http://www.anders.com/projects/webgallery/">webgallery</a>

comments and questions are welcome. enjoy!