|
1 |
| -# Avatar |
| 1 | +# Avatar 1.0.0 |
2 | 2 | Yet another avatar architecture for MediaWiki
|
3 | 3 |
|
| 4 | +**Note.** There are API changes when upgrading 0.9.2 to 1.0.0. The change is very likely to break your site. See section below for details. |
| 5 | + |
4 | 6 | ## Install
|
5 | 7 | * Install php-gd, which is a dependency of this extension
|
6 | 8 | * Clone the respository, rename it to Avatar and copy to extensions folder
|
7 |
| -* Add wfLoadExtension('Avatar'); to your LocalSettings.php |
| 9 | +* Add `wfLoadExtension('Avatar')`; to your LocalSettings.php |
8 | 10 | * You are done!
|
9 | 11 |
|
10 | 12 | ## Configuration
|
11 |
| -* $wgDefaultAvatar (string), should be set to the URL of the default avatar. |
12 |
| -* $wgAllowedAvatarRes (array), default value is array(64, 128). Thumbnails will be created upon request when their size is in this list. |
13 |
| -* $wgMaxAvatarResolution (integer), default value is 256. This limits maximum resolution of image to be uploaded. |
14 |
| -* $wgDefaultAvatarRes (integer), default value is 128. This is the fallback option if resolution is not specified. |
| 13 | +* `$wgDefaultAvatar` (string), should be set to the URL of the default avatar. |
| 14 | +* `$wgAllowedAvatarRes` (array), default value is array(64, 128). Thumbnails will be created upon request when their size is in this list. |
| 15 | +* `$wgMaxAvatarResolution` (integer), default value is 256. This limits maximum resolution of image to be uploaded. |
| 16 | +* `$wgDefaultAvatarRes` (integer), default value is 128. This is the fallback option if resolution is not specified. |
15 | 17 | * You can set user rights:
|
16 |
| - * avatarupload: User need this right to upload ones' own avatar. |
17 |
| - * avataradmin: User need this right to delete others' avatars. |
| 18 | + * `avatarupload`: User need this right to upload ones' own avatar. |
| 19 | + * `avataradmin`: User need this right to delete others' avatars. |
18 | 20 |
|
19 | 21 | ## How to use
|
20 |
| -* Set avatar in user preference, and then $wgScriptPath/extensions/Avatar/avatar.php?username will be redirected to your avatar. |
| 22 | +* Set avatar in user preference, and then `$wgScriptPath/extensions/Avatar/avatar.php?user=username` will be redirected to your avatar. |
21 | 23 | * You can set alias for this php to make it shorter.
|
| 24 | + |
| 25 | +## Detailed API |
| 26 | +* Uploading Avatar: No API provided yet, but one can post to `Special:UploadAvatar` (or its localized equivalent). The only form data required is `avatar`, which should be set to the data uri of the image. |
| 27 | +* Displaying Avatar: This extension provides an entry point for MediaWiki `avatar.php`. This entry point produces result via a 302 redirect. This approach is used to maximize performance while still utilizing MediaWiki core. There are currently 4 available arguments. |
| 28 | + * `user` set to the user of who you want to enquery the avatar |
| 29 | + * `res` the preferred resolution of the avatar. Note that this is only a hint and the actual result might not be of the resolution. This parameter is valid only if `user` is set. |
| 30 | + * `ver` a version number which will be appended to the location field of redirection. Can be used to circumvent browser/CDN cache. |
| 31 | + * `nocache` if this parameter is set, then no `cache-control` header will be emitted. |
22 | 32 |
|
23 | 33 | ## Extra resources
|
24 | 34 | * If you are using Gadgets
|
25 | 35 | * If you want to display the avatar on the top-right navigation bar, you may find Gadget-ShowAvatar in example folder useful.
|
26 | 36 | * If you want to display avatars before user link, you may find Gadget-UserLinkAvatar in example folder useful.
|
27 | 37 |
|
| 38 | +## Upgrading from <1.0.0 to 1.0.0 |
| 39 | +* `wgScriptPath/extensions/Avatar/avatar.php?username` was changed to `wgScriptPath/extensions/Avatar/avatar.php?user=username` |
| 40 | +* `wgScriptPath/extensions/Avatar/avatar.php?username/resolution` was changed to `wgScriptPath/extensions/Avatar/avatar.php?user=username&res=resolution` |
| 41 | +* The change affects all Gadgets and depending extensions. |
| 42 | +* Upgrading is easy: changing all occurrence of above url to the new fashion. |
0 commit comments