7a6c63e3e52e9e70e90c6fac7c449c92752322b5
[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 - Supports the ``mm`` fallback image (mystery man)
16
17 __ http://wiki.libravatar.org/api/
18
19
20 =====
21 Setup
22 =====
23
24 1. Copy ``data/surrogator.config.php.dist`` to ``data/surrogator.config.php``
25    (remove the ``.dist``)
26 2. Adjust the config file to your needs
27 3. Create a default image and put it into the raw folder, name it ``default.png``
28 4. Setup your web server and set the document root to the ``www/`` directory.
29    Make sure you allow the ``.htaccess`` file and have ``mod_rewrite`` activated.
30 5. Add DNS entries for ``_avatars._tcp`` and ``_avatars-sec._tcp``.
31    A bind config file excerpt would look like this::
32
33     _avatars._tcp.example.org.     IN SRV 0 0 80  avatars.example.org
34     _avatars-sec._tcp.example.org. IN SRV 0 0 443 avatars.example.org
35
36    This makes the avatar server ``avatars.example.org`` responsible for
37    the domain ``example.org``, on ports 80 (HTTP) and 443 (HTTPS).
38
39 It is possible to use an existing domain as avatar server.
40 Just copy ``avatar.php`` into its document root dir and copy the rewrite rule
41 from ``.htaccess`` into the domain's ``.htaccess`` file if one exists.
42 If not, copy the whole ``.htaccess`` file.
43 After that, you have to point the ``$cfgFile`` path at the beginning of
44 the ``avatar.php`` file to the correct location.
45
46
47 =====
48 Usage
49 =====
50
51 1. Put images in ``raw/`` folder.
52    Name has to be email address + image file extension, for example
53    ``foo@example.org.png``.
54    Surrogator supports ``.png`` and ``.jpg``.
55 2. Run ``php surrogator.php``.
56    The small files get generated.
57 3. You will get more information with ``-v``
58 4. When you run ``surrogator.php`` again, it will only generate small files
59    when the raw file is newer than the "square" file in the var folder.
60    You can force the update with ``--force``.
61
62
63 ====
64 Test
65 ====
66
67 To check if everything is setup correctly, try the following tools:
68
69 - `Libravatar domain check tool`__ for DNS resolution tests
70 - `Libravatar server check tool`__ for image resolving tests
71
72 __ https://www.libravatar.org/tools/check_domain
73 __ https://www.libravatar.org/tools/check
74
75 See the libravatar wiki about `running a custom server`__ and
76 the `API specification`__ for more information.
77
78 __ http://wiki.libravatar.org/running_your_own/
79 __ http://wiki.libravatar.org/api/
80
81
82 =======
83 License
84 =======
85 Surrogator is licensed under the `AGPL v3`__ or later.
86
87 __ http://www.gnu.org/licenses/agpl.html
88
89
90 ======
91 Author
92 ======
93 Written by Christian Weiske, cweiske@cweiske.de