Extension:Semantic Image Input

From MediaWiki.org
Jump to: navigation, search
shortcut: SII
MediaWiki extensions manual - list
Crystal Clear action run.png
Semantic Image Input

Release status: beta

Implementation Special page, Ajax, User interface
Description Semantic Image Input allows for automatic adding of images from Wikipedia pages
Author(s) Jeroen De Dauw
Latest version 0.1 (2011-11-10)
MediaWiki 1.17.0 or higher
PHP 5.3 or above
Database changes no
License GNU GPL v3+

Translate the Semantic Image Input extension if possible

Check usage and version matrix; code metrics
Bugs: list open list all report

About[edit | edit source]

Semantic Image Input allows for automatic adding of images from Wikipedia pages via a Semantic Forms input.

Feature overview[edit | edit source]

  • Image input that automatically fetches the first image from a Wikipedia page.
  • Wikipedia redirect resolving.
  • Support for multiple instance templates in forms.

Requirements[edit | edit source]

Semantic Image Input requires:

Download[edit | edit source]

You can find the current version of Semantic Image Input on the Google Code download page, as well as a list of legacy downloads.

You can download the extension directly from the MediaWiki source code repository (browse code). You can get:

One of the extensions tags

Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag

  • Go to the tags list
  • Click the name of the tag you want to download
  • Click "snapshot"
The latest version of one of the extensions branches

Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.

  • Go to the branches list
  • Click the branch name
  • Click "snapshot"
A snapshot made during the release of a MediaWiki version.

This might be unstable and is not guaranteed to work with the associated MediaWiki version.

After you've got the code, save it into the extensions/Semantic Image Input directory of your wiki.

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Semantic+Image+Input.git

Installation[edit | edit source]

Once you have downloaded the code, place the SemanticImageInput directory within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file:

# Semantic Image Input
require_once( "$IP/extensions/SemanticImageInput/SemanticImageInput.php" );

You will also need to enable instant commons for the embedding of images to work. This can be done with:

# Enable instant commons
$wgUseInstantCommons  = true;

Beware that in recently installed MediaWikis, this setting might already be present, in which case you should make sure it's set to true instead of adding another copy.

Configuration[edit | edit source]

Configuration of Semantic Image Input is done by assigning to $egSIISettings in your LocalSettings.php file. The options are listed below and their default is set in the Semantic Image Input settings file. You should NOT modify the settings file, but can have a look at it to get an idea of how to use the settings, in case the below descriptions do not suffice.

Example of how to change a setting:

$egSIISettings['defaultWidth'] = 250;

Available settings:

Name Type Default Description
defaultImage string File:Mail-envelope.png The default image to add in case no image could be obtained.
defaultWidth integer 200 The default

Usage[edit | edit source]

The input added by this extension is called "instantimage" and it has 2 modes, which can be chosen using the "type" parameter.

Page mode[edit | edit source]

In page mode, the input will pull an image from the Wikipedia page with the same name as the page being edited or created.

{{{field|Image|mandatory|input type=instantimage|type=page}}}

Item mode[edit | edit source]

Item mode is for in multiple instance templates. The input will find the first input in the multiple instance template, and on every change of the value in this input, look up a corresponding image.

{{{field|Image|mandatory|input type=instantimage|type=item}}}

Form example[edit | edit source]

Example of a form with an input in page mode and one in item mode:

{{{for template|Book}}}

'''Description:''' {{{field|Description|input type=text}}}

'''Image:''' {{{field|Image|mandatory|input type=instantimage|type=page}}}

{{{end template}}}

== Authors ==

{{{for template|Book author|label=Author|multiple}}}
'''Name:''' {{{field|Name|input type=text}}}

'''Image:''' {{{field|Image|input type=instantimage|type=item}}}

{{{end template}}}

No image shows[edit | edit source]

When there is no matching Wikipedia article, or the matching article has no images, no image will be shown. Furthermore, only images under open licences that can be found on Wikimedia Commons will be shown. In case the first image of a Wikipedia article is not under such a licence, but used under fair usage policy, it will not be shown.

Version[edit | edit source]

This is a copy of the release notes file on SVN, which might be more up to date then this page.

Version 0.1[edit | edit source]


  • Image input that automatically fetches the first image from a Wikipedia page.
  • Wikipedia redirect resolving.
  • Support for multiple instance templates in forms.

Internationalization[edit | edit source]

Semantic Image Input is fully internationalized. Translation of Semantic Image Input messages is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.

Authors[edit | edit source]

Semantic Image Input has been written by Jeroen De Dauw for WhoInspired.

Screenshots[edit | edit source]

See also[edit | edit source]

External links[edit | edit source]