Tof: a web photo album

1. How to install ?

First of all, you need an http server with PHP4 (PHP3 is unsupported), and postgresql. PHP should be compiled with gettext and postgresql support (casual Debian packages should work fine).

Unpack the archive and go in the created directory:

tar zxf tof-<version>.tar.gz
cd tof-<version>

Rename the file config.php.sample into config.php, and edit it to satisfy your needs; you should set the following parameters: database name, login and password, photos path.

Also edit init.sql and choose a password for the "admin" user.

Create a database with createdb, and create the tables :

createdb <dbname>
psql <dbname> < base.sql
psql <dbname> < init.sql

To install the files, edit Make.conf and set "INSTALL_DIR" to the directory where you want the scripts to be installed and then run "make install". The directory must exist.

If you do not have gettext installed, it is likely that some steps will fail when doing "make install". Don't worry it will work anyway, however you will only have the english version.

It should now work. You can point your browser to <base_url>/photos.php. You'll see an empty album.

2. How do I create users ?

Loggin as "admin", use the "admin view", then users. Fill in the form.

3. How do I add pictures in the album ?

3.1 General considerations

There are two methods you can use to add pictures. Whatever the method you will use, there are some things you should know about.

A picture belong to exactly one roll. A roll is owned by a user and only that user can add pictures to it.

A picture can belong to any number of albums. You must have write access to an album in order to be able to put pictures in it.

3.2 Using the online uploading form

In order to be able to use this method, the web server must have write access to the $basePath directory (defined in config.php). If your web server can't be made to have write access to this directory, you will have use ftp or any other means to put the files in the directory yourself (see below).

You must use the "admin view", and then either follow the "updload picures" link from the top bar, or the "upload pictures" link in the view of a topic.

You can the either upload pictures one by one, or put several pictures in an archive (zip or tar) and upload that archive. In either case, you must choose a roll where to put the pictures in. You can enter the name of a new roll to be created (you don't need to prefix with your login name). You can also choose an album where to put the pictures in. And you can enter the name of a new album (it will be made as a sub-albnum of the selected album).

And at last, you can choose who will be able to see the pictures.

3.3 Uploading files by hand (with ftp, etc)

Images are stored in files. The $basePath parameter in config.php defines the root directory where the files are to be found. Thumbnails filenames must end with $thumb_suffix and normal size filenames must end with $picture_suffix.

To add new pictures, you should create a directory per user in $basePath. This is to avoid possible name clashes between users. A user shouldn't have to care about other users rolls. And in the directory of the user, there must be a directory per roll. For instance, for user miguel and roll birthday, you would have:

        $basePath
          `+miguel
              `+birthday
                  `+picture1-t.jpg
                   +picture1-w.jpg
                   +picture2-t.jpg
                   +picture2-t.jpg
                           .
                           .
                           .

Once the files are there, you can user the web interface to "declare" the new roll. You must be logged in, go to the "admin view", and then "my rolls". Or directly point your browser to "/admin.php?MyRolls". Choose a rollID for the roll, check "add all pictures", (this add all unregistered pictures found in the rolls directory in the new roll), select a initial topic where to put the pictures, and initial groups that will be able to see the pictures. When you create a new user, a single user group is created for that user. The logged in user is always added so that the owner of a picture can always see it.

You can also add new pictures to an already existing album. In "admin view", go to "My rolls", the click on a roll and use the "Add pictures form".

4. About internationalisation and languages support.

Tof can support languages other than english. Only french is available for the moment. And it is very unlikely that I will translate it into other language, so if you want to translate in into an other language here's how to proceed :

In the po directory, run the following command :

xgettext --keyword=_ -C ../slooze_render_basic.php

It will create a file named "messages.po". Rename it to <lang>.po where <lang> is the 2 characters representing your language, and edit the msgstr in that file. Then send me the result so that I can include it in the next release.

You don't need to have any knowledge of PHP in order to do this. However you may notice some HTML code in the msgid texts (like <a href=\"mailto:%s\"> or </a>). You should just leave the text between "<" and ">" as is.

However, in order to see the new language on the web pages, a little hacking in the sources is necessary. You should add a the language in the function lang_init() in slooze.php and in the file po/Makefile.

The language selection is dynamic and is done according to the accept-language variable sent by the browser. So if you have "fr" in the language preferences of you browser, you will see the french version.

5. If you need help

There's a mailing list hosted by savannah.gnu.org. See subscribing instructions.

You should be able to post without being subscribed. To do this, just send a mail to tof-general@mail.freesoftware.fsf.org. And don't forget to mention that you are not subscribed so that you receive the answer. You can talk english or french on this mailing list.

You can consult the archives ot the ML.