3c219e95bb1147e00db4635e5d0b0a16340e0f3e
[surrogator.git] / README.rst
1 **********
2 Surrogator
3 **********
4
5 Simple open source Libravatar__ compatible avatar image server written in PHP.
6
7 Features:
8
9 - Delivers images for email addresses
10 - Very easy to setup.
11 - No graphics processing is done on the server, keeping the CPU load low.
12   All avatar images get pre-generated for a set of sizes
13 - If no image at the user requested size is found, the next larger image gets
14   returned.
15
16 __ http://wiki.libravatar.org/api/
17
18
19 =====
20 Setup
21 =====
22
23 1. Copy ``data/surrogator.config.php.dist`` to ``data/surrogator.config.php``
24    (remove the ``.dist``)
25 2. Adjust the config file to your needs
26 3. Create a default image and put it into the raw folder, name it ``default.png``
27 4. Setup your web server and set the document root to the ``www/`` directory.
28    Make sure you allow the ``.htaccess`` file and have ``mod_rewrite`` activated.
29 5. Add DNS entries for ``_avatars._tcp`` and ``_avatars-sec._tcp``.
30    A bind config file excerpt would look like this::
31
32     _avatars._tcp.example.org.     IN SRV 0 0 80  avatars.example.org
33     _avatars-sec._tcp.example.org. IN SRV 0 0 443 avatars.example.org
34
35    This makes the avatar server ``avatars.example.org`` responsible for
36    the domain ``example.org``, on ports 80 (HTTP) and 443 (HTTPS).
37
38 It is possible to use an existing domain as avatar server.
39 Just copy ``avatar.php`` into its document root dir and copy the rewrite rule
40 from ``.htaccess`` into the domain's ``.htaccess`` file if one exists.
41 If not, copy the whole ``.htaccess`` file.
42 After that, you have to point the ``$cfgFile`` path at the beginning of
43 the ``avatar.php`` file to the correct location.
44
45
46 =====
47 Usage
48 =====
49
50 1. Put images in ``raw/`` folder.
51    Name has to be email address + image file extension, for example
52    ``foo@example.org.png``.
53    Surrogator supports ``.png`` and ``.jpg``.
54 2. Run ``php surrogator.php``.
55    The small files get generated.
56 3. You will get more information with ``-v``
57 4. When you run ``surrogator.php`` again, it will only generate small files
58    when the raw file is newer than the "square" file in the var folder.
59    You can force the update with ``--force``.
60
61
62 ====
63 Test
64 ====
65
66 To check if everything is setup correctly, try the following tools:
67
68 - `Libravatar domain check tool`__ for DNS resolution tests
69 - `Libravatar server check tool`__ for image resolving tests
70
71 __ https://www.libravatar.org/tools/check_domain
72 __ https://www.libravatar.org/tools/check
73
74
75 =======
76 License
77 =======
78 Surrogator is licensed under the `AGPL v3`__ or later.
79
80 __ http://www.gnu.org/licenses/agpl.html
81
82
83 ======
84 Author
85 ======
86 Written by Christian Weiske, cweiske@cweiske.de