Estensione:CommonsMetadata
CommonsMetadata Stato della release: stabile |
|
---|---|
Implementazione | API |
Descrizione | Prova ad estrarre metadati dalle pagine commons |
Autore(i) | Brian Wolff (bawolffdiscussione) |
Politica di compatibilità | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | 1.25+ |
PHP | 5.4+ |
Modifiche al Database | No |
Licenza | GNU General Public License 2.0 or later |
Scaricare | |
|
|
Quarterly downloads | 84 (Ranked 60th) |
Public wikis using | 1,055 (Ranked 247th) |
Traduci l'estensione CommonsMetadata se è disponibile su translatewiki.net | |
Problemi | Compiti aperti · Riportare un bug |
L'estensione CommonsMetadata è un tentativo di estrarre metadati dalle pagine di Wikimedia Commons. Aggiunge alcune informazioni extra all'API imageinfo, basate su template e categorie presenti nella descrizione dell'immagine. It adds some extra information to the imageinfo API, based on templates and categories in the image description. It is used by several extensions/tools (such as Estensione:MultimediaViewer , Extension:VisualEditor , Extension:MobileFrontend , Mobile-Content-Service (MCS)) to provide better lightboxes or image selection dialogs.
L'estensione nella sua forma attuale è intesa come soluzione temporanea, da sostituirsi con Wikidata su Commons.
Installazione
- Download and move the extracted
CommonsMetadata
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CommonsMetadata - Aggiungi il seguente codice al tuo $LocalSettings (preferibilmente alla fine):
wfLoadExtension( 'CommonsMetadata' );
- Done – Naviga in Special:Version nella tua wiki per verificare che l'estensione sia stata installata correttamente.
Motivazioni e scelte progettuali
Le assunzioni fatte per questa estensione sono le seguenti.
- Ad un certo punto in futuro, wikidata prenderà in mano la gestione dei metadati su commons. Per evitare cambiamenti troppo marcati, che verrebbero subito modificati nuovamente, l'estensione dovrebbe lavorare con i metadati di commons, come avviene attualmente (senza introdurre nuove funzioni di analisi). Da qui lo screen scraping.
- The content of many of the fields on a commons description page includes rich formatting (In particular: Links, italics, bold. In some cases, more complex things like embedded images)
- As a result, the extension outputs parsed html (wikitext sucks, plain text doesn't capture the data)
- Furthermore, 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", it's hard to convert that to a precise date (many examples can be).
- To carry that forward, also apply formatting to EXIF metadata, which is controlled on the 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-specific as possible, with the commons and non-commons parts separated.
- Commons description pages have multilingual descriptions. Lots of users probably want one language.
- This implementation 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 separator on numbers)
Configuration
parameter | default | description |
---|---|---|
$wgCommonsMetadataSetTrackingCategories
|
false
|
Add the following tracking categories to file pages when the corresponding information is not provided either via templates on the file page of (for some of these) EXIF metadata:
|
$wgCommonsMetadataPublicDomainPageUrl
|
https://commons.wikimedia.org/wiki/Help:Public_domain
|
Link used for 'license' attribute in schema.org markup for files in the public domain. |
$wgCommonsMetadataForceRecalculate
|
false
|
Force calculation of metadata even when the image is from a foreign repository that would provide it. This is meant for local development. |
Testing
When testing with remote images (e.g. Commons images if you have enabled $wgUseInstantCommons
), you can set $wgCommonsMetadataForceRecalculate = true;
to force CommonsMetadata to parse the description page of the image and extract the metadata (normally, if the remote repository had CommonsMetadata installed as well, it would just copy the API output from there).
Uso
Usa l'API imageinfo ed inserisci extmetadata
come proprietà dell'informazione dell'immagine specificata attraverso il parametro iiprop
.
Esempio di utilizzo:
Visualizza questo esempio nella API sandbox:
Returned data
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. It 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).
Vedi anche
- Gestione dei metadati dei file
- Manual:File metadata handling
- Estensione:MultimediaViewer - attualmente l'utente principale delle informazioni fornite da CommonsMetadata
- Richiesta di commenti sulla gestione delle informazioni delle immagini
- Individuazione dei template sulle wiki locali con file caricati localmente – Descrive come preparare i template per estrarre i metadati e poi mostrarli quando si usa l'estensione MultimediaViewer
Questa estensione viene utilizzata su uno o più progetti Wikimedia. Ciò probabilmente significa che l'estensione è stabile e funziona abbastanza bene da essere utilizzata da siti Web ad alto traffico. Cerca il nome di questa estensione nei file di configurazione CommonSettings.php e InitialiseSettings.php di Wikimedia per vedere dove è installato. Un elenco completo delle estensioni installate su un particolare wiki può essere visto sulla pagina Special:Version del wiki. |
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Stable extensions/it
- API extensions/it
- GPL licensed extensions/it
- Extensions in Wikimedia version control/it
- ContentAlterParserOutput extensions/it
- GetExtendedMetadata extensions/it
- SkinAfterBottomScripts extensions/it
- ValidateExtendedMetadataCache extensions/it
- All extensions/it
- Extensions used on Wikimedia/it
- Extensions included in Canasta/it
- Extensions included in Miraheze/it
- Extensions included in WikiForge/it
- Metadata/it
- Data extraction extensions/it