Extension:Avatar

This page is a translated version of the page Extension:Avatar and the translation is 31% complete.
Manuel des extensions MediaWiki
Avatar
État de la version : non-maintenu
Implémentation Interface utilisateur
Description Cette extension fournit un système d'avatars qui peut être utilisé par d'autres extensions
Auteur(s) Gary Guo (Nbdd0121discussion)
Dernière version 1.0.0 (2016-05-24)
MediaWiki 1.25+
Modifie la base
de données
Non
Licence Licence simplifiée BSD 2-clause
Téléchargement
README
$wgDefaultAvatar, $wgAllowedAvatarRest, $wgMaxAvatarResolution, $wgDefaultAvatarRes
avatarupload, avataradmin
A ne pas confondre avec Extension:Avatars.

Avatar - Encore une autre architecture d'avatars pour MediaWiki. Cette extension fournit un système d'avatars qui peut être utilisé par d'autres extensions.

Installer

  • Installez php-gd qui est nécessaire pour cette extension.
  • Clonez le dépôt, renommez-le en Avatar et copiez-le dans le dossier extensions.
  • Ajoutez wfLoadExtension('Avatar'); à votre LocalSettings.php.
  • Vous avez fini !

Configuration

  • $wgDefaultAvatar (string) - Should be set to the URL of the default avatar.
  • $wgAllowedAvatarRes (array) - Default value is array(64, 128). Thumbnails will be created upon request when their size is in this list.
  • $wgMaxAvatarResolution (integer) - Default value is 256. This limits maximum resolution of image to be uploaded.
  • $wgDefaultAvatarRes (integer) - Default value is 128. This is the fallback option if resolution is not specified.
  • You can set the following user rights:
    • avatarupload: User need this right to upload ones' own avatar.
    • avataradmin: User need this right to delete others' avatars.

How to use

  • Users can upload avatar in their preference
  • Administrators or other users with the avataradmin right can delete avatar via Special:ViewAvatar
  • A new entry point for MediaWiki is added, $wgScriptPath/extensions/Avatar/avatar.php?user=username will be redirected to user's avatar.
  • You can also set alias for this php to make it shorter.
  • If you are using Gadgets
    • If you want to display the avatar on the top-right navigation bar, you may find Gadget-ShowAvatar in example folder useful.
    • If you want to display avatars before user link, you may find Gadget-UserLinkAvatar in example folder useful.
 
Gadget-ShowAvatar

Detailed API

  • 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.
  • 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.
    • user: Set to the user of who you want to enquery the avatar.
    • 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.
    • ver: A version number which will be appended to the location field of redirection. Can be used to circumvent browser/CDN cache.
    • nocache: If this parameter is set, then no `cache-control` header will be emitted.