Difference between revisions of "Template:img/doc"

From WikiCorporates
Jump to navigation Jump to search
m (→‎Tmp)
(→‎Floating an image opposite an Info Box)
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
−
<< [[Template:img]]
+
__NOTOC__
 +
Simple template to format and display images that have not been uploaded. Path is set to <code><nowiki>{{SERVER}}/Images/</nowiki></code>
  
−
Simple template to make my life easier.
+
=== Parameters ===
−
<pre>
 
−
Path is set to {{SERVER}}/Images/
 
−
</pre>
 
−
 
 
−
==== Tmp ====
 
−
1.  New information is coming out increasingly, to show the relationship between air pollution and infertility. <span style="margin-right:10px; margin-left:10px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20"></span> It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term.<br/>
 
−
2. <span style="float:right; margin-left:10px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20"></span> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term.<br/>
 
−
3. <span style="float:left; margin-right:10px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20"></span> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term.
 
−
{{hline}}
 
−
4. <div style="width:60px; margin-right:10px; margin-left:10px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20"></div> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term. <br/>
 
−
5. <div style="float:left; margin-right:10px; margin-left:10px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20"></div> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term. <br/>
 
−
6. <div style="float:right; margin-left:10px; margin-right:10px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20"></div> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term.
 
−
{{hline}}
 
−
7. <div style="text-align:center; font-size:80%; width:60px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20">A caption.</div> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term. <br/>
 
−
8. <div style="float:right; margin-left:10px; text-align:center; font-size:80%; width:60px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20">A caption.</div> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term. <br/>
 
−
9. <div style="float:left; margin-right:10px; text-align:center; font-size:80%; width:60px; border:1px solid red;"><img src="http://wikipolitiks.local/Images/Compass.svg" width="60" height="20">A caption.</div> New information is coming out increasingly, to show the relationship between air pollution and infertility. It is currently estimated by the CDC that 6.7 million women have impaired ability to get pregnant or to carry a baby to term.
 
−
{{hline}}
 
−
 
 
−
=== Usage ===
 
 
<pre>
 
<pre>
 
{{img
 
{{img
−
|image-name.png - the filename of the image
+
|image-name.svg - filename of the image
 
|300            - width
 
|300            - width
 
|200            - height
 
|200            - height
−
|float          - optional. [left | right | none]. If left empty, the image will float right, with a 10px right margin.
+
|float          - optional. [left|right|none]. If not set, the image will float right, with margin-left=10px.
 
|ml              - optional margin-left. If left empty, the default is 10px.
 
|ml              - optional margin-left. If left empty, the default is 10px.
 
|mr              - optional margin-right. If left empty, the default is 10px.
 
|mr              - optional margin-right. If left empty, the default is 10px.
 +
|pb              - optional. Padding-bottom, so can space stacked images apart.
 
|border          - optional border colour
 
|border          - optional border colour
 
|caption        - optional image caption
 
|caption        - optional image caption
−
|round          - optionally round. Must use square images for this to work nicely.
+
|round          - optional. Square images rendered round; rectangular images rendered oval.
 
}}
 
}}
 
</pre>
 
</pre>
  
 
=== Examples ===
 
=== Examples ===
−
Testing float=none, margin-left=8px, margin-right=20px: XXXXX{{img|Compass.svg|60|20|float=none|ml=8px|mr=20px}}XXXXX
+
To float an image on the same line as a header:
 +
<div>{{img|Ineos-Petroineos.png|134|30}}
 +
==== This is a Header ====
 +
</div>
 +
<pre style="margin-right:12em; padding:0 1em;">
 +
<div>{{img|Internet-Security-Research-Group-Lets-Encrypt.svg|150|116}}
 +
=== PetroIneos ===
 +
</div>
 +
</pre>
 +
 
 +
<b>OR</b>
 +
 
 +
==== This is a Header ====
 +
{{Info Small|ntb=1|img={{img|Ineos-Petroineos.png|134|30}} }}
 +
<div>Note this has an underline underneath the image. </div>
 +
<pre style="margin-right:12em; padding:0 1em;">
 +
==== This is a Header ====
 +
{{Info Small|ntb=1|img={{img|Ineos-Petroineos.png|134|30}} }}
 +
</pre>
  
−
<pre>{{img|Financial-Weapons-of-Mass-Destruction.png|100|100|border=#808080}}</pre>
+
==== Floating an image opposite an Info Box ====
−
Gives:
+
<pre style="margin-right:12em; padding:0 1em;">
−
{{img|Financial-Weapons-of-Mass-Destruction.png|100|100|border=#808080}}
+
<div style="display:flex;"><br/>
 +
<div style="flex:1 1 auto;">Lorem ipsum dolor sit amet...</div>
 +
<div style="flex:0 0 90px;">{{img|Economists-for-Brexit.png|77|30|float=none}} &nbsp; </div>
 +
</div>
 +
</pre>
 +
Gives:<br/>
 +
<div style="display:flex;">
 +
<div style="flex:1 1 auto;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
 +
<div style="flex:0 0 90px;">{{img|Economists-for-Brexit.png|77|30|float=none}} &nbsp; </div>
 +
</div>
 +
 
 +
Good example on [[Economists for Free Trade]]. See developer.mozilla.org for detailed info on [https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox flexbox].
 +
 
 +
==== Keep Images Within a "li" ====
 +
This will keep images within the list item, even when opposite another image, table, or whatever. For a good example, see [[Pets at Home Group plc]]
 +
<ul style="overflow:auto; overflow:hidden;">
 +
<li>[[File:Pets-at-Home-Pets-at-Home.svg|49x30px|right]] {{em|b=1|Pets at Home:}} the omni-channel retailing business operates from the [http://www.petsathome.com/ Pets at Home] "one-stop-shop" store network and website.</li>
 +
<li>[[File:Pets-at-Home-Groom-Room.svg|47x30px|right]] {{em|b=1|Groom Room:}} dog and cat grooming services, through [https://www.petsathome.com/shop/en/pets/in-store-services/new-groom-room Groom Room] salons, are found within many Pets at Home stores, offering full dog grooming, baths, microchipping and nail clipping. </li>
 +
</ul>
 +
<pre style="margin-right:12em; padding:0 1em;">
 +
<ul style="overflow:auto; overflow:hidden;">
 +
<li>[[File:Pets-at-Home-Pets-at-Home.svg|49x30px|right]] {{em|b=1|Pets at Home:}} the omni-channel retailing business operates from the [http://www.petsathome.com/ Pets at Home] "one-stop-shop" store network and website.</li>
 +
<li>[[File:Pets-at-Home-Groom-Room.svg|47x30px|right]] {{em|b=1|Groom Room:}} dog and cat grooming services, through [https://www.petsathome.com/shop/en/pets/in-store-services/new-groom-room Groom Room] salons, are found within many Pets at Home stores, offering full dog grooming, baths, microchipping and nail clipping. </li>
 +
</ul>
 +
</pre>
 +
 
 +
==== Miscellaneous Examples ====
 +
{{img|file=1|Pets-at-Home-Pets-at-Home.svg|100|61|border=#808080|caption=Financial Weapons of Mass Destruction}}
 +
<pre style="margin-right:12em; padding:0 1em;">
 +
{{img|file=1|Pets-at-Home-Pets-at-Home.svg|100|61|border=#808080
 +
|caption=Financial Weapons of Mass Destruction]}}
 +
</pre>
 
{{Clear}}
 
{{Clear}}
  
−
{{img|Cannabis-Law-Reform.svg|103|100|border=black}}
+
{{img|Financial-Weapons-of-Mass-Destruction.png|100|100|border=#808080|caption=Financial Weapons of Mass Destruction}}
 +
<pre style="margin-right:12em; padding:0 1em;">
 +
{{img|Financial-Weapons-of-Mass-Destruction.png|100|100|border=#808080
 +
|caption=Financial Weapons of Mass Destruction]}}
 +
</pre>
 +
{{Clear}}
 +
 
 +
{{img|Cannabis-Law-Reform.svg|103|100|border=#808080}}
 +
<pre style="margin-right:12em; padding:0 1em;">{{img|Cannabis-Law-Reform.svg|103|100|border=#808080}}</pre>
 +
{{Clear}}
 +
 
 +
'''Inline, with defaults margin-left=5px, margin-right=5px:'''  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.{{img|Compass.svg|60|20|float=none|border=red}} Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 +
 
 +
'''Inline, with user-set margin-left=0px, and default margin-right=5px:'''  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.{{img|Compass.svg|60|20|ml=0|float=none|border=red}} Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 +
 
 +
{{img|Compass.svg|60|20|border=red}} '''Float right, with default margin-left=10px:''' <code><nowiki>{{img|Compass.svg|60|20|border=red}}</nowiki></code> {{Lorem ipsum}}
 +
 
 +
{{img|Compass.svg|60|20|ml=20|mr=50|border=red}} '''Float right, with user-set margin-left=20px and margin-right=50px:''' <code><nowiki>{{img|Compass.svg|60|20|ml=20|mr=50|border=red}}</nowiki></code> {{Lorem ipsum}}
 +
 
 +
{{img|Compass.svg|60|20|float=left}} '''Float left, with defaults margin-left=0px and margin-right=10px:''' <code><nowiki>{{img|Compass.svg|60|20|float=left}}</nowiki></code> {{Lorem ipsum}}
 +
 
 +
{{img|Compass.svg|60|20|float=left|border=#808080|caption=A Caption}} '''Float left, with defaults margin-left=0, margin-right=10px, Caption and Border:''' <code><nowiki>{{img|Compass.svg|60|20|float=left|border=#808080|caption=A Caption}}</nowiki></code> {{Lorem ipsum}}
 +
 
 +
{{img|Andrew-Bridgen.png|67|80|round=1}} '''Round image:''' <code><nowiki>{{img|Andrew-Bridgen.png|67|80|round=1}} </nowiki></code>takes all the same parameters as above. Round images work best, but rectangular ones are also fine. {{Lorem ipsum}}
 +
<!--
 +
<div style="float:right;">
 +
<div>[[File:Nestle-2015-horiz.svg|200x56px]]</div>
 +
<div>{{img|Princes-Gate-Cariad-Coffee.svg|200|87}}</div>
 +
</div>
 +
-->
  
−
<pre>
+
{{floatRightStacked|sep=0|[[File:Nestle-2015-horiz.svg|200x56px]]|{{img|Princes-Gate-Cariad-Coffee.svg|200|68|float=none|ml=0|mr=0}}}}
−
{{img
+
'''Stacked images:''' <br/>
−
|Toy-Factory-Wages.png
+
<code><nowiki>{{floatRightStacked</nowiki></code><br/>
−
|200
+
<code><nowiki>|sep=0</nowiki></code><br/>
−
|217
+
<code><nowiki>|[[File:Nestle-2015-horiz.svg|200x56px]]</nowiki></code><br/>
−
|border=red
+
<code><nowiki>|{{img|Princes-Gate-Cariad-Coffee.svg|200|87|float=none|ml=0|mr=0}}</nowiki></code><br/>
 +
<code><nowiki>}}</nowiki></code><br/>
 +
{{Lorem ipsum}}
 +
 
 +
'''Captions'''
 +
{{img|Toy-Factory-Wages.png|200|217|float=right|border=red|caption=[http://www.chrismadden.co.uk/cartoon-gallery/exploitation-of-factory-workers-in-the-developing-world/ Need to pay £4 for this]}}
 +
<pre style="margin-right:12em; padding:0 1em;">
 +
{{img|Toy-Factory-Wages.png|200|217|border=red
 
|caption=[http://www.chrismadden.co.uk/cartoon-gallery/exploitation-of-factory-workers-in-the-developing-world/ Need to pay £4 for this]}}
 
|caption=[http://www.chrismadden.co.uk/cartoon-gallery/exploitation-of-factory-workers-in-the-developing-world/ Need to pay £4 for this]}}
 
</pre>
 
</pre>
−
Gives:
 
−
{{img|Toy-Factory-Wages.png
 
−
|200|217
 
−
|border=red
 
−
|caption=[http://www.chrismadden.co.uk/cartoon-gallery/exploitation-of-factory-workers-in-the-developing-world/ Need to pay £4 for this]}}
 
  
−
<includeonly>[[Category:WikiPolitiks templates]]</includeonly>
+
<includeonly>[[Category:WikiCorporates templates]]</includeonly>

Latest revision as of 13:54, 16 September 2020

Simple template to format and display images that have not been uploaded. Path is set to {{SERVER}}/Images/

Parameters

{{img
|image-name.svg  - filename of the image
|300             - width
|200             - height
|float           - optional. [left|right|none]. If not set, the image will float right, with margin-left=10px.
|ml              - optional margin-left. If left empty, the default is 10px.
|mr              - optional margin-right. If left empty, the default is 10px.
|pb              - optional. Padding-bottom, so can space stacked images apart.
|border          - optional border colour
|caption         - optional image caption
|round           - optional. Square images rendered round; rectangular images rendered oval.
}}

Examples

To float an image on the same line as a header:

This is a Header

<div>{{img|Internet-Security-Research-Group-Lets-Encrypt.svg|150|116}}
=== PetroIneos ===
</div>

OR

This is a Header

Note this has an underline underneath the image.
==== This is a Header ====
{{Info Small|ntb=1|img={{img|Ineos-Petroineos.png|134|30}} }}

Floating an image opposite an Info Box

<div style="display:flex;"><br/>
 <div style="flex:1 1 auto;">Lorem ipsum dolor sit amet...</div>
 <div style="flex:0 0 90px;">{{img|Economists-for-Brexit.png|77|30|float=none}}   </div>
</div>

Gives:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 

Good example on Economists for Free Trade. See developer.mozilla.org for detailed info on flexbox.

Keep Images Within a "li"

This will keep images within the list item, even when opposite another image, table, or whatever. For a good example, see Pets at Home Group plc

  • Pets-at-Home-Pets-at-Home.svg
    Pets at Home: the omni-channel retailing business operates from the Pets at Home "one-stop-shop" store network and website.
  • Pets-at-Home-Groom-Room.svg
    Groom Room: dog and cat grooming services, through Groom Room salons, are found within many Pets at Home stores, offering full dog grooming, baths, microchipping and nail clipping.
<ul style="overflow:auto; overflow:hidden;">
<li>[[File:Pets-at-Home-Pets-at-Home.svg|49x30px|right]] {{em|b=1|Pets at Home:}} the omni-channel retailing business operates from the [http://www.petsathome.com/ Pets at Home] "one-stop-shop" store network and website.</li>
<li>[[File:Pets-at-Home-Groom-Room.svg|47x30px|right]] {{em|b=1|Groom Room:}} dog and cat grooming services, through [https://www.petsathome.com/shop/en/pets/in-store-services/new-groom-room Groom Room] salons, are found within many Pets at Home stores, offering full dog grooming, baths, microchipping and nail clipping. </li>
</ul>

Miscellaneous Examples

Pets-at-Home-Pets-at-Home.svgFinancial Weapons of Mass Destruction
{{img|file=1|Pets-at-Home-Pets-at-Home.svg|100|61|border=#808080
|caption=Financial Weapons of Mass Destruction]}}
Financial Weapons of Mass Destruction
{{img|Financial-Weapons-of-Mass-Destruction.png|100|100|border=#808080
|caption=Financial Weapons of Mass Destruction]}}

{{img|Cannabis-Law-Reform.svg|103|100|border=#808080}}

Inline, with defaults margin-left=5px, margin-right=5px: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Inline, with user-set margin-left=0px, and default margin-right=5px: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Float right, with default margin-left=10px: {{img|Compass.svg|60|20|border=red}} Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Float right, with user-set margin-left=20px and margin-right=50px: {{img|Compass.svg|60|20|ml=20|mr=50|border=red}} Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Float left, with defaults margin-left=0px and margin-right=10px: {{img|Compass.svg|60|20|float=left}} Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

A Caption

Float left, with defaults margin-left=0, margin-right=10px, Caption and Border: {{img|Compass.svg|60|20|float=left|border=#808080|caption=A Caption}} Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Round image: {{img|Andrew-Bridgen.png|67|80|round=1}} takes all the same parameters as above. Round images work best, but rectangular ones are also fine. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Nestle-2015-horiz.svg

Stacked images:
{{floatRightStacked
|sep=0
|[[File:Nestle-2015-horiz.svg|200x56px]]
|{{img|Princes-Gate-Cariad-Coffee.svg|200|87|float=none|ml=0|mr=0}}
}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Captions

Need to pay £4 for this
{{img|Toy-Factory-Wages.png|200|217|border=red
|caption=[http://www.chrismadden.co.uk/cartoon-gallery/exploitation-of-factory-workers-in-the-developing-world/ Need to pay £4 for this]}}