Extension:CommonsMetadata
![]() État de la version : stable |
|
---|---|
Implémentation | API |
Description | Tentatives d'extraction de métadonnées à partir de pages communes |
Auteur(s) | Brian Wolff (bawolffdiscussion) |
Politique de compatibilité | Versions ponctuelles alignées avec MediaWiki. Le master n'est pas compatible arrière. |
MediaWiki | 1.25+ |
PHP | 5.4+ |
Modifie la base de données |
Non |
Licence | Licence publique générale GNU v2.0 ou supérieur |
Téléchargement | |
|
|
Téléchargements trimestriels | 114 (Ranked 68th) |
Utilisé par les wikis publics | 1,055 (Ranked 247th) |
Traduire l’extension CommonsMetadata sur translatewiki.net si elle y est disponible | |
Problèmes | Tâches ouvertes · Signaler un bogue |
L'extension CommonsMetadata est une tentative d'extraction de métadonnées à partir des pages Wikimedia Commons, mais est également disponible dans tous les autres projets Wikimedia. It adds some extra information to the imageinfo API, based on templates and categories in the image description. It is used by a number of extensions / tools (such as Extension:MultimediaViewer/fr , Extension:VisualEditor , Extension:MobileFrontend , Mobile-Content-Service (MCS)) to provide better lightboxes or image selection dialogs.
The extension in its current form is intended to be a temporary solution, eventually replaced by Wikidata on Commons.
Motivation & design choices
Voir mailarchive:wikitech-l/2013-August/071593.html
The assumptions of this extension are the following.
- At some point in the future, wikidata will take over handling metadata at commons. In order to avoid disruptive changes, which will soon need to be changed again, the extension should work with commons metadata as it currently is (so not introducing new parser functions). Hence screen scraping.
- The content of many of the fields on a commons description page include rich formatting (In particular: Links, italics, bold. In some cases more complex things like embedded images)
- As a result, extension outputs parsed html (wikitext sucks, plain text doesn't capture the data)
- Futhermore, the data tends to be formatted for human display, rather than (for example) machine formatted dates. When the date field says something like "circa 1600s", its hard to convert that to a precise date (otoh, many examples can be).
- To carry that forward, also apply formatting to exif metadata, which is controlled on wiki (For example, commons links the camera name to a wikipedia article)
- If we can't extract info from the description page, but the file has the author tagged in exif/XMP/iptc metadata, we should use that as a fallback.
- Ideally such a system would be as commons-inspecific as possible, with the commons and non-commons part separated.
- Commons description pages have multilingual descriptions. Lots of users probably just want one language.
- In this implementation, it applies per language conventions to dates and things. Additionally for explicitly multi-lingual fields (description), there is an option to return all, or just a single language. Even in single language mode, some things are still language specific (like the thousands seperator on numbers)
Installation
- Téléchargez et placez le(s) fichier(s) dans un répertoire appelé
CommonsMetadata
dans votre dossierextensions/
.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CommonsMetadata - Ajoutez le code suivant à la fin de votre fichier LocalSettings.php :
wfLoadExtension( 'CommonsMetadata' );
Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.
Testing
Lors du test avec des images distantes (par exemple des images Commons si vous avez activé $wgUseInstantCommons
), vous pouvez définir $wgCommonsMetadataForceRecalculate = true;
pour forcer CommonsMetadata à analyser la page de description de l'image et à extraire les métadonnées (normalement, si le référentiel distant avait également CommonsMetadata installé, il copierait simplement la sortie de l'API à partir de là).
Utilisation
Use the imageinfo API, and include extmetadata
as an image info property specified via iiprop
.
Example usage:
View this example in the API sandbox:
Données renvoyées
The extension currently provides the following items in the extmetadata
field of the response (the field names were chosen, where possible, to follow the IPTC-IIM format used in EXIF headers):
Data based on machine-readable data in the Information template:
- ImageDescription - image description
- Artist - author name (might contain complex HTML, multiple authors etc)
- Credit - source
- DateTimeOriginal - time of creation (space-separated ISO 8601 timestamp whenever possible, but can be any other textual description of a date, possibly with HTML mixed in)
- ObjectName - title (for a book/painting; otherwise just the file name)
- Permission - contents of the Permission field of the template. Can be a lot of things (license template, OTRS id, details on how to attribute...)
- AuthorCount - the number of templates with authors (e.g. Book, Photograph...). The number of actual authors might be higher if a template describes multiple authors in a single string.
Data based on machine-readable data in the Location template:
- GPSLatitude - latitude
- GPSLongitude - longitude
- GPSMapDatum - coordinate type (only
WGS-84
supported for now)
Data based on machine-readable data in the license template:
- LicenseShortName - short human-readable license name
- LicenseUrl
- UsageTerms
- Copyrighted -
True
orFalse
(for public domain images)
For multi-licensed images these values are currently unreliable.
- Attribution - custom attribution that should replace Artist + Credit (can also originate from the Information template)
- AttributionRequired - booleanish (phab:T86726), tells whether there is a legal requirement to attribute
- NonFree - booleanish, true means the image is not under a free license. (Used for non-Commons images only.)
Other data:
- CommonsMedadataExtension - contains the metadata parser version number; mostly for internal use
- License - a best guess at the license of the image (mostly for internal use by MediaViewer, might change; LicenseShortName is probably more reliable)
- Categories - a
|
-separated list of the categories of the image.
Based on parsing category names, probably won't work for images not hosted on Commons.
- Restrictions - reuse restrictions such as trademarks or personality rights; an array of keywords (the class names from this table, without the
restriction-
prefix). See also the restrict-* icons in MediaViewer. - DeletionReason - if set, the template is being considered for deletion.
(Based on the nuke template, probably not reliable outside Commons.) It contains a deletion reason, but it is phrased to be applicable for a log entry, so it might be misleading (e.g. past tense when actually it is not yet decided whether the image will be deleted).
Voir aussi
- Manual:File metadata handling
- Extension:MultimediaViewer/fr - currently the main user of the information provided by CommonsMetadata.
- Request for comment on handling image information
- Template detection on local wikis with locally uploaded files – Describes how to prepare the templates for fetching metadata and thus displaying them when using the MultimediaViewer extension.
![]() | Cette extension est utilisée par au moins un des projets Wikimédia. Cela signifie probablement que l’extension est assez stable et fonctionnelle pour être utilisée sur des sites à fort trafic. Recherchez le nom de cette extension dans le CommonSettings.php de Wikimédia et dans le fichier de configuration InitialiseSettings.php pour situer les endroits où elle est installée. Une liste complète des extensions installées sur un Wiki donné peut être visualisée sur la page Special:Version de ce wiki. |
![]() | Cette extension est incluse dans les fermes de wikis ou les hôtes suivants et / ou les paquets : Cette liste ne fait pas autorité. Certaines fermes de wikis ou hôtes et / ou paquets peuvent contenir cette extension même s'ils ne sont pas listés ici. Vérifiez toujours cela avec votre ferme de wikis ou votre hôte ou votre paquet avant de confirmer. |
- Stable extensions/fr
- API extensions/fr
- GPL licensed extensions/fr
- Extensions in Wikimedia version control/fr
- ContentAlterParserOutput extensions/fr
- GetExtendedMetadata extensions/fr
- SkinAfterBottomScripts extensions/fr
- ValidateExtendedMetadataCache extensions/fr
- All extensions/fr
- Extensions used on Wikimedia/fr
- Extensions included in Canasta/fr
- Extensions included in Miraheze/fr
- Extensions included in WikiForge/fr
- Extensions included in WikiTide/fr
- Metadata/fr
- Data extraction extensions/fr