Extension:SpriteSheet
This extension is incompatible with MediaWiki 1.38 or any later release! You are advised against using this extension on a live site. Volunteer developers are invited to pledge their efforts to updating this extension to make it compatible with MediaWiki 1.41 by replacing the {{Incompatible }} template with {{Incompatible |version=1.38|pledge=~~~~}} . |
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
SpriteSheet Release status: unmaintained |
|
---|---|
Implementation | Parser function |
Description | Adds a parser functions called #sprite and #slice to display defined sections of an image without having to use an external editor. |
Author(s) | Alexia E. Smith (Alexia E. Smith), Hydra Wiki Platform Team |
Latest version | 1.3.2 (2018-12-10) |
MediaWiki | 1.31+ |
PHP | 7.0+ |
Database changes | Yes |
License | GNU Lesser General Public License 3.0 |
Download | GitHub:
<translate> Note:</translate> |
|
|
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'). |
The SpriteSheet extension allows uploaded images to be divided into sprite sheets or custom slices to be displayed without having to use an external image editor. The resulting sprites and slices are dynamically generated using CSS.
Installation
- <translate> <tvar name=1>Download</tvar> and place the file(s) in a directory called <tvar name=name>
SpriteSheet
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'SpriteSheet' );
- <translate> Run the [[<tvar name=update>Special:MyLanguage/Manual:Update.php</tvar>|update script]] which will automatically create the necessary database tables that this extension needs.</translate>
- 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>
Configuration
There are two available rights that may be assigned to groups, 'edit_sprites' and 'spritesheet_rollback'. The 'edit_sprites' permission gives the ability to edit sprite sheets, sprites, slices, assign names, and delete. The 'spritesheet_rollback' allows the ability to rollback changes from the change log.
Default permissions:
$wgGroupPermissions['autoconfirmed']['edit_sprites'] = true;
$wgGroupPermissions['sysop']['spritesheet_rollback'] = true;
Usage
File:SpriteSheet-BasicInterface.png
Tags
#sprite - Parser Tag
The #sprite tag format accepts X and Y coordinate positions to select a section of the image in a traditional column and row format.
Basic Syntax:
{{#sprite:file=File:Example.png|column=0|row=0}}
It can also be spaced across lines for readability:
{{#sprite: file=File:Example.png |column=0 |row=0 }}
With optional resize and link:
{{#sprite: file=File:Example.png |column=0 |row=0 |resize=300 |link=ExampleArticle }}
Parameters for #sprite Tag
Parameter | Description |
---|---|
file
|
Required: yes
|
column
|
Required: yes
|
row
|
Required: yes
|
resize
|
Required: no, Default: null
|
link
|
Required: no, Default: null
|
Example
To display the sprite located at column 4, row 2:
{{#sprite: file=File:Hanamura-screenshot.jpg |column=4 |row=2 }}
File:SpriteSheet-SpriteUsageExample.png
#ifsprite - Parser Tag
The #ifsprite tag is used to display a named sprite if it exists. If the named sprite does not actually exist yet it will instead return the given wiki text.
Basic Syntax:
{{#ifsprite: file=File:Example.png |name=TestSprite |wikitext={{SpriteNotFound}} }}
Parameters for #ifsprite Tag
Parameter | Description |
---|---|
file
|
Required: yes
|
name
|
Required: yes
|
resize
|
Required: no, Default: none
|
wikitext
|
Required: yes, Default: none
|
Example
{{#ifsprite: file=File:Hanamura-screenshot.jpg |name=Plaque |wikitext=[http://www.example.com/ Use This Example] }}
#slice - Parser Tag
The #slice tag takes X and Y positioning along with width and height sizing to select a section of the image. All four parameters take units in pixels(px) or percentages(%), but they all must use the same unit.
Basic Syntax:
{{#slice:file=File:Example.png|x=0|y=0|width=10|height=10}}
It can also be spaced across lines for readability:
{{#slice: file=File:Example.png |x=0 |y=0 |width=10 |height=10 }}
With optional resize and link:
{{#slice: file=Example.png |x=0 |y=0 |width=10 |height=10 |resize=300 |link=ExampleArticle }}
Parameters for #slice Tag
Parameter | Description |
---|---|
file
|
Required: yes
|
x
|
Required: yes
|
y
|
Required: yes
|
width
|
Required: yes
|
height
|
Required: yes
|
resize
|
Required: no, Default: null
|
link
|
Required: no, Default: null
|
Example
{{#slice: file=File:Hanamura-screenshot.jpg |x=27.88 |y=32.31 |width=25.62 |height=25.55 }}
File:SpriteSheet-SliceUsageExample.png
#ifslice - Parser Tag
The #ifslice tag is used to display a named slice if it exists. If the named slice does not actually exist yet it will instead return the given wiki text.
Basic Syntax:
{{#ifslice: file=File:Image_Name.png |name=SliceTest |wikitext={{SpriteNotFound}} }}
Parameters for #ifslice Tag
Parameter | Description |
---|---|
file
|
Required: yes
|
name
|
Required: yes
|
resize
|
Required: no, Default: none
|
wikitext
|
Required: yes, Default: none
|
Example
{{#ifslice: file=File:Hanamura-screenshot.jpg |name=Plaque |wikitext=[http://www.example.com/ Use This Example] }}
Naming Sprites/Slices
File:SpriteSheet-SpriteNaming.png
After a sprite or slice has been selected a pop up will open under the tag preview. This allows a custom name to be set for the selection that can be recalled later. It uses the same #sprite and #slice parser tags with the "name" parameter instead of specifying the positioning.
{{#sprite:file=File:Hanamura-screenshot.jpg|name=Plaque}}
{{#sprite:file=File:Hanamura-screenshot.jpg|name=Plaque|resize=800}}
{{#slice:file=File:Hanamura-screenshot.jpg|name=Plaque}}
{{#slice:file=File:Hanamura-screenshot.jpg|name=Plaque|resize=500}}
File:OOjs UI icon information-progressive.svg | <translate> This extension is included in the following wiki farms/hosts and/or packages:</translate>
<translate> This is not an authoritative list.</translate> <translate> Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.</translate> <translate> Always check with your wiki farms/hosts or bundle to confirm.</translate> |
- Pages with script errors
- Pages with broken file links
- Extensions incompatible with 1.38
- Unmaintained extensions
- Extensions without an image
- Parser function extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- LGPL licensed extensions
- Extensions in GitHub version control
- ParserFirstCallInit extensions
- ImagePageShowTOC extensions
- ImageOpenShowImageInlineBefore extensions
- PageRenderingHash extensions
- TitleMoveComplete extensions
- LoadExtensionSchemaUpdates extensions
- All extensions
- Image extensions