Difference between revisions of "Template:ImageGallery"

From Bearscape Wiki
Jump to: navigation, search
m (Trying to fix this, it isn't working as expected (but it is close).)
(Edit to the template to not use margin and translate on the img, but instead make the div a table-cell with alignment to center the image, plus make the wrapper p tag have no margin to fix this.)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
<ul class="gallery mw-gallery-traditional">
+
{{#css:
<!--<li class="gallerybox" style="width: 155px">
+
  div.galleryDiv
<div style="width: 155px">
+
  {
<div class="thumb" style="height: 155px">
+
    display: table-cell;
<p style="max-width: none; max-height: none; width: 100%; height: 150px; margin: 2.5px auto">
+
    text-align: center;
<span class="plainlinks">[http://bearscape.org/commissions/cbxcommission.png <img src="http://bearscape.org/commissions/cbxcommission.png" style="max-width: 100%; max-height: 100%">]</span>
+
    vertical-align: middle;
</p>
+
  }
</div>
+
  p.pWrapper
<div class="gallerytext">
+
  {
TESTING BECAUSE FUCKING MEDIAWIKI BULLSHIT
+
    margin: 0;
</div>
+
  }
</div>
+
}}<gallery style="display: none"></gallery><ul class="gallery mw-gallery-traditional">
</li>-->
 
 
{{
 
{{
 
   #fornumargs: number
 
   #fornumargs: number
Line 17: Line 16:
 
   |{{
 
   |{{
 
     #ifexpr: {{#var: number}} mod 2
 
     #ifexpr: {{#var: number}} mod 2
     | <nowiki />
+
     |<li class="gallerybox" style="margin-right: 10px">
<li class="gallerybox" style="width: 155px">
 
 
<div style="width: 155px">
 
<div style="width: 155px">
<div class="thumb" style="height: 155px">
+
<div class="thumb plainlinks galleryDiv" style="width: 150px; height: 150px; padding: 2.5px">
<p style="max-width: none; max-height: none; width: 100% height: 150px; margin: 2.5px auto">
+
<p class="pWrapper">
<span class="plaintext">[{{#var: value}} <img src="{{#var: value}}" style="max-width: 100%; max-height: 100%">]</span>
+
{{#ifeq: {{#sub: {{#var: value}}|0|4}} | http | [{{#var: value}} <img src="{{#var: value}}" style="max-width: 150px; max-height: 150px" class="galleryImage">] | [[File:{{#var: value}}|150x150px|class=galleryImage]]}}
 
</p>
 
</p>
 
</div>
 
</div>
Line 32: Line 30:
 
   }}
 
   }}
 
}}
 
}}
</ul>
+
</ul><noinclude>
 +
This template is a replication of the built-in MediaWiki &lt;gallery&gt; tag, but allowing external images as well.
 +
 
 +
To utilize it, add the following to a page:
 +
 
 +
<pre>{{ImageGallery
 +
|URL1
 +
|COMMENT1
 +
|URL2
 +
|COMMENT2
 +
...
 +
|URLn
 +
|COMMENTn
 +
}}</pre>
 +
 
 +
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:
 +
 
 +
<pre>{{ImageGallery
 +
|http://www.cyberbotx.com/TinulothelKuroSprite.png
 +
|A (former) staff
 +
|http://pishi.cyberbotx.com/stuff/overworld.png
 +
|Overworld!
 +
|http://www.cyberbotx.com/customBnG/cbxwubby1.png
 +
|
 +
|2014-03-29-04.png
 +
|I'm stealin' Temia's image, mwahaha!
 +
}}</pre>
 +
 
 +
(Notice how the second to last URL has no comment, but the | for the comment is still needed.)
 +
 
 +
Will render as follows:
 +
 
 +
{{ImageGallery
 +
|http://www.cyberbotx.com/TinulothelKuroSprite.png
 +
|A (former) staff
 +
|http://pishi.cyberbotx.com/stuff/overworld.png
 +
|Overworld!
 +
|http://www.cyberbotx.com/customBnG/cbxwubby1.png
 +
|
 +
|2014-03-29-04.png
 +
|I'm stealin' Temia's image, mwahaha!
 +
}}
 +
</noinclude>

Latest revision as of 07:09, 19 February 2018

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://www.cyberbotx.com/TinulothelKuroSprite.png
|A (former) staff
|http://pishi.cyberbotx.com/stuff/overworld.png
|Overworld!
|http://www.cyberbotx.com/customBnG/cbxwubby1.png
|
|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: