PhotoShelf installation. ======================= PhotoShelf is quite big and featureful, and you will probably need to install various pre-requisites in your system. The following is required in order to install: - Perl 5 - Apache+mod_perl (it'll run like a slug otherwise) (it has been reported that SpeedyCGI http://daemoninc.com/speedycgi/ and FastCGI http://www.fastcgi.com work as replacements for mod_perl - untested though) - A PostgreSQL database - jpegtran, from libjpeg (rotates jpeg images losslessly) You'll also need to grab the following perl modules from CPAN: - Archive::Tar - Compress::Zlib (for Archive::Tar) - Archive::Zip - CGI::Cookie - DBI + DBD::Pg - MailTools (for Mail::Mailer) - Digest::MD5 - HTTP::Date (part of the libwww-perl package) - File::MMagic - Image::Info - IO::String (for Image::Info) - Image::Magick (requires ImageMagick devel package) Yep that's a lot, but each of them plays an important role: Archive::* These modules let it handle tar and zip archives which you can upload and they will be unpacked. They also handle downloading of albums as zip/tar files. CGI::Cookie PhotoShelf uses HTTP cookies for authentication and session management. DBI Required for database communications. Don't forget to also get the driver module for your database. (DBD::Pg) Digest::MD5 PhotoShelf MD5 hashes all images, so that duplicates and other nasties can be avoided. File::MMagic Used to determine what type of file has been uploaded, ie jpg, zip, tar, and in the future other image types. The filename is not the best way! Image::Info Used to extract EXIF header information that is inserted into the JPG files by most digital cameras. Image::Magick Used to do basic image manipulation, such as resizing to create thumbs. :) Other operations planned in future versions will also use module. Once these modules are installed. You're ready for the rest. :) Easy Install ------------ The easiest way to install PhotoShelf is to just run the installation script, install.pl. This will go through all of the prerequisites and ensure that they are correct. Perl modules can be automatically retrieved and installed by it, and it goes through your apache config to determine the correct settings and paths for photoshelf. Note that this script might still be buggy, however all parts of it have been tested and you should have no problems most of the time. If the script runs successfully, then you're ready to roll and dont really need to read further. PhotoShelf.pm ------------ This perl module is the guts of it all really. :) Before installation, edit PhotoShelf.pm and edit around line 14 and change the variable $DefaultDir to point to the location of the web server installation under mod_perl. Then install it, by going into the 'PhotoShelf' subdirectory, and running the usual perl module installation procedure, which is: perl Makefile.PL make make install That should do it. Database setup. --------------- Once you have your database installed (if not, insert sub-step here), edit 'photoshelf.cfg', and modify any variables you see fit. They are all documented quite well. This file gets eval()'ed by PhotoShelf, so you can also do funny perl stuff here. Don't forget to set the database user and hostname. Then you need to set up the database. This entails creating the database, and dropping in initial tables and values. For PostgreSQL, the following is done: # psql template1 Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit template1=> create database photodb; CREATEDB template1=> \q # psql -f photodb.template -d photodb This will then go and setup the database for you. If there are any errors, look carefully for incompatible keywords, etc. If all is OK here, you can go on to the next step. Apache setup ------------ You can run PhotoShelf without mod_perl, but believe me, you will *want* to run it. My Apache config has the following in the perl lines: DocumentRoot "/home/httpd/html" PerlHandler Apache::Registry PerlFreshRestart On PerlSendHeader On and also: Alias /ps/ /home/httpd/ps/ SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI Script installation ------------------- Into the directory of installation (ie where the web server will read the scripts), put the file 'photoshelf.cfg' and also the contents of the 'scripts' directory. Also put the dirs 'helpfiles' and 'cache' into here. The directory 'cache' *must* be owned by the userid that the web server will run the scripts as, and the file 'image.dat' also needs to be owned by this user. The files in 'helpfiles', and 'cache' must be copied into the corresponding directories in the installation. Also you need to replace all occurances of '/photoshelf/images/' in the helpfiles with the correct URI for the images. The install script takes care of this for you, otherwise you need to do it manually. You will need to place the files for the images somewhere. Put the contents of the 'images' directory somewhere accessible by the web server, and then update the variable $IcoUrl in the photoshelf.cfg file to point to the URI of this directory. Into another part of the web server tree, you will need to create the repository. To do this, you need to find a directory on a filesystem with plenty of disk space (enough to hold all images and two alternative sizes for them). Edit the photoshelf.cfg file with both the true system location of this directory, and the web server URI for it. You will also need to have the database running. When ready, run the script 'make-dirs.pl' in the tools directory. This will create the repository and insert the initial entries into the database. Also into this directory, copy the file 'functions.js'. Next, you need to make sure that apache recognises the files in the repository as jpeg files. Either you must enable the mod_mime_magic module, or you should add the following to the config: AddType image/jpeg .img AddType image/jpeg .100 AddType image/jpeg .640 Otherwise the server will respond with text/plain for the images, breaking the UI. Create a directory called 'tmp' under the install directory, and set its ownership to that of the user that the scripts run under. Otherwise uploads will not work. Lastly, you must configure users of the system - run the adduser.pl script in the tools/ directory for each user to add.