Difference between revisions of "Template:ImageGallery"
m (Something in MediaWiki 1.26 makes the gallery CSS not show up on a page if no <gallery> tag is used... so add an empty one just before my <ul> tag to force the CSS to be there. Really dumb, really.) |
m (Allow the URLs to be local wiki images in addition to external URLs. (It does NOT check if said image is actually uploaded to the wiki, though.)) |
||
| Line 1: | Line 1: | ||
| − | <gallery></gallery><ul class="gallery mw-gallery-traditional"> | + | {{#css: |
| + | .galleryImage | ||
| + | { | ||
| + | margin: 77.5px !important; | ||
| + | transform: translate(-50%, -50%); | ||
| + | } | ||
| + | }}<gallery></gallery><ul class="gallery mw-gallery-traditional"> | ||
{{ | {{ | ||
#fornumargs: number | #fornumargs: number | ||
| Line 8: | Line 14: | ||
<div style="width: 155px"> | <div style="width: 155px"> | ||
<div class="thumb" style="width: 155px; height: 155px"> | <div class="thumb" style="width: 155px; height: 155px"> | ||
| − | <span class="plainlinks" style="display: block; width: 150px; height: 150px">[{{#var: value}} <img src="{{#var: value}}" style="max-width: 100%; max-height: 100% | + | <span class="plainlinks" style="display: block; width: 150px; height: 150px">{{#ifeq: {{#sub: {{#var: value}}|0|4}} | http | [{{#var: value}} <img src="{{#var: value}}" style="max-width: 100%; max-height: 100%" class="galleryImage">] | [[File:{{#var: value}}|150x150px|class=galleryImage]]}}</span> |
</div> | </div> | ||
|<div class="gallerytext"> | |<div class="gallerytext"> | ||
| Line 19: | Line 25: | ||
</ul> | </ul> | ||
<noinclude> | <noinclude> | ||
| − | This template is a replication of the built-in MediaWiki <gallery> tag, but | + | This template is a replication of the built-in MediaWiki <gallery> tag, but allowing external images as well. |
To utilize it, add the following to a page: | To utilize it, add the following to a page: | ||
| Line 33: | Line 39: | ||
}}</pre> | }}</pre> | ||
| − | You will need at least one URL and COMMENT combination for this to render properly. If you wish to have an image in the gallery not have a comment, then just leave the COMMENT empty, but do NOT exclude the pipe symbol. | + | You will need at least one URL and COMMENT combination for this to render properly. If the URL starts with http or https, it'll be assumed to be external, otherwise it'll be assumed to be local to the wiki (and must be uploaded to the wiki). If you wish to have an image in the gallery not have a comment, then just leave the COMMENT empty, but do NOT exclude the pipe symbol. |
An example gallery with this template: | An example gallery with this template: | ||
| Line 44: | Line 50: | ||
|http://pixabay.com/static/uploads/photo/2014/08/20/05/22/big-bang-422305_640.jpg | |http://pixabay.com/static/uploads/photo/2014/08/20/05/22/big-bang-422305_640.jpg | ||
| | | | ||
| − | | | + | |2014-03-29-04.png |
| − | | | + | |I'm stealin' Temia's image, mwahaha! |
}}</pre> | }}</pre> | ||
| − | (Notice how the last | + | (Notice how the second to last URL has no comment, but the | for the comment is still needed.) |
Will render as follows: | Will render as follows: | ||
| Line 59: | Line 65: | ||
|http://pixabay.com/static/uploads/photo/2014/08/20/05/22/big-bang-422305_640.jpg | |http://pixabay.com/static/uploads/photo/2014/08/20/05/22/big-bang-422305_640.jpg | ||
| | | | ||
| − | | | + | |2014-03-29-04.png |
| − | | | + | |I'm stealin' Temia's image, mwahaha! |
}} | }} | ||
</noinclude> | </noinclude> | ||
Revision as of 05:49, 29 January 2016
This template is a replication of the built-in MediaWiki <gallery> tag, but allowing external images as well.
To utilize it, add the following to a page:
{{ImageGallery
|URL1
|COMMENT1
|URL2
|COMMENT2
...
|URLn
|COMMENTn
}}
You will need at least one URL and COMMENT combination for this to render properly. If the URL starts with http or https, it'll be assumed to be external, otherwise it'll be assumed to be local to the wiki (and must be uploaded to the wiki). If you wish to have an image in the gallery not have a comment, then just leave the COMMENT empty, but do NOT exclude the pipe symbol.
An example gallery with this template:
{{ImageGallery
|http://pixabay.com/static/uploads/photo/2014/10/10/22/07/sun-483984_640.jpg
|A sunset
|http://pixabay.com/static/uploads/photo/2012/04/26/19/47/penguin-42936_640.png
|A penguin (''beware'')
|http://pixabay.com/static/uploads/photo/2014/08/20/05/22/big-bang-422305_640.jpg
|
|2014-03-29-04.png
|I'm stealin' Temia's image, mwahaha!
}}
(Notice how the second to last URL has no comment, but the | for the comment is still needed.)
Will render as follows:


