Extension:CommonsMetadata/scn
CommonsMetadata Release status: stable |
|
---|---|
Implementation | API |
Description | Prova a estràiri metadati dê pàggini commons |
Author(s) | Brian Wolff (bawolfftalk) |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | 1.25+ |
PHP | 5.4+ |
Database changes | No |
License | No license specified |
Download | |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the CommonsMetadata extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The CommonsMetadata extension is an attempt at extracting metadata from Wikimedia Commons pages but is also available at all other Wikimedia projects. 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 Estinzioni:MultimediaViewer , Extension:VisualEditor , Extension:MobileFrontend , Mobile-Content-Service (MCS)) to provide better lightboxes or image selection dialogs.
L'estinzioni ntâ sò forma attuali è ntisa comu suluzzioni timpurània, do sistituìrisi cu Wikidata nta Commons.
Nstallazzioni
- <translate> [[<tvar name=2>Special:ExtensionDistributor/CommonsMetadata/scn</tvar>|Download]] and move the extracted <tvar name=name>
CommonsMetadata/scn
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CommonsMetadata%2Fscn - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'CommonsMetadata/scn' );
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Mutivazzioni e scigghiuti pruggittuali
L'assunzioni fatti pi st'estinzioni sunnu li siguenti.
- Ôn certu puntu n futuru, wikidata pigghia n manu la gistioni dê metadati nta commons. P'evitari canciamenti troppu marcati, ca vinìssiru sùbbitu canciati novamenti, l'estinzioni avissi a travagghiari chê metadati di commons, comu avveni attualmenti (senza ntrodùciri funzioni d'anàlisi novi). Di ccà lu 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)
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 which 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).
Usu
Use the imageinfo API, and include extmetadata
as an image info property specified via iiprop
.
Example usage:
View this example in the 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. 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).
Talìa puru
- Gistioni dê metadati dê file
- Manual:File metadata handling
- Estinzioni:MultimediaViewer - attualmenti l'utenti principali dê nfurmazzioni furnuti di CommonsMetadata
- Addumannata di cummenti ntâ gistioni dê nfurmazzioni dê màggini
- 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.
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |
File:OOjs UI icon information-progressive.svg |
- Pages with script errors
- Pages with broken file links
- Stable extensions/scn
- API extensions/scn
- Extensions with manual MediaWiki version
- Extensions with no license specified/scn
- Extensions in Wikimedia version control/scn
- All extensions/scn
- Extensions not in ExtensionJson
- Extensions used on Wikimedia/scn
- Metadata/scn
- Data extraction extensions/scn