Difference between revisions of "Wiki File Resolver"
GiselaWeber (Talk | contribs) m |
|||
Line 8: | Line 8: | ||
From ForeignAPIRepo wikimediacommons: | From ForeignAPIRepo wikimediacommons: | ||
− | http://biowikifarm.net/metawiki/index.php?title=Special: | + | http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaURL&objectName=File:PelobatesFuscus.jpg |
− | http://biowikifarm.net/metawiki/index.php?title=Special: | + | http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaFile&objectName=File:PelobatesFuscus.jpg&width=200 |
From ForeignDBRepos: | From ForeignDBRepos: | ||
− | http://biowikifarm.net/metawiki/index.php?title=Special: | + | http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaURL&objectName=File:Blatt%20gelappt.svg&width=400 |
− | http://biowikifarm.net/metawiki/index.php?title=Special: | + | http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaFile&objectName=File:Blatt%20gelappt.svg&width=400 |
− | http://biowikifarm.net/metawiki/index.php?title=Special: | + | http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaURL&objectName=File:Mauerraute.jpg&width=200 |
− | http://biowikifarm.net/metawiki/index.php?title=Special: | + | http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaFile&objectName=File:Mauerraute.jpg |
[[Category: Software documentation]] | [[Category: Software documentation]] |
Latest revision as of 23:06, 25 November 2010
Mediawiki stores its files inside a repository structure, that uses MD5 hashes as part of the file name. This makes direct access to a binary file (image etc.) slightly difficult if you only know the wiki-name of the file (like File:XY.jpg). However, mediawiki also may be configured to use a series of external repositories, including wikimedia commons. When resolving a file like XY.jpg, mediawiki will go through the repository definitions, and returns the file from the first repository containing a name of this file. This behavior is impossible to re-implement without detailed knowledge about the attached repositories.
As a solution, the Mobile Key extension offers a web service that may also be used independently of mobile key developing. This service resolves wiki file names (the binary files for which may come from local or a variety of attached repositories). It offers the two functions: action=getMediaURL (return URL as string) and action=getMediaFile (directly resolve Media file).
The first returns a single string, which is the URL to the media file, setting MIME type to text, the second returns the binary media file, setting MIME type to image/xxx. Optionally a width parameter can be set for both, in which case a thumb will be dynamically rendered.
Examples:
From ForeignAPIRepo wikimediacommons: http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaURL&objectName=File:PelobatesFuscus.jpg http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaFile&objectName=File:PelobatesFuscus.jpg&width=200
From ForeignDBRepos: http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaURL&objectName=File:Blatt%20gelappt.svg&width=400 http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaFile&objectName=File:Blatt%20gelappt.svg&width=400 http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaURL&objectName=File:Mauerraute.jpg&width=200 http://biowikifarm.net/metawiki/index.php?title=Special:MobileKeyV1&action=getMediaFile&objectName=File:Mauerraute.jpg