Difference between revisions of "Template:Articleimage"

From Twinsuniverse
Jump to: navigation, search
m
(added infobox)
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
+
<includeonly>{{
{{#ifexist: File:{{{1|doesnot}}}
+
#ifeq: {{{1|}}} |
| [[Image:{{{1|Divers.gif}}}|{{{2|Image of}}} {{PAGENAME}}]]
+
| [[Image:Divers.gif|No image was specified for this article]]{{
| [[Image:Divers.gif|{{{2|Image of}}} {{PAGENAME}} (missing)]] {{
+
    #ifeq: {{{nocat|false}}} | false | [[Category:Articles without an image]]{{
    #ifeq: {{{nocat|false}}} | false | [[Category:Articles without an image]]}}
+
        #vardefine: infobox_messages | {{#var:infobox_messages|}}{{missingimage}}}}}}
}}</includeonly><noinclude>
+
| {{
This template makes it easier to add an image to an article, that automatically displays a default image when incorrect.
+
  #ifexist: File:{{{1}}}
 +
  | [[Image:{{{1|Divers.gif}}}|frameless|center|{{{2|Image of {{PAGENAME}}}}}]]
 +
  | [[Image:Divers.gif|The image &quot;{{{1}}}&quot; is missing or has no description page]]{{
 +
        #ifeq: {{{nocat|false}}} | false | [[Category:Articles with a missing image]]{{
 +
            #vardefine: infobox_messages | {{#var:infobox_messages|}}{{missingimage|{{{1}}}}}}}}}}}
 +
}}</includeonly><noinclude>{{Infobox Template
 +
|purpose=infobox
 +
|singletag=no
 +
|multiline=yes
 +
|gamerelated=no
 +
|suppressible=no
 +
|choice=single
 +
|cat1=Articles with a missing image!''with filename''
 +
|cat2=Articles without an image!''without filename''
 +
|var1=infobox_messages!Infobox!active
 +
}}
 +
 
 +
This template makes it easier to add an image to an article, that automatically displays a default image when incorrect. This also automatically categorizes the article under [[:Category:Articles with a missing image]] when the specified image doesn't exist, or under [[:Category:Articles without an image]] when no image or an empty value was given.
  
 
==Parameters==
 
==Parameters==
 
# The filename of an image from [[:Category:Images]] or a subcategory (no parameter name but filename is case sensitive, defaults to an empty image)
 
# The filename of an image from [[:Category:Images]] or a subcategory (no parameter name but filename is case sensitive, defaults to an empty image)
# The text to show in the tooltip before the page name, when hovering the image (no parameter name but text is case sensitive, defaults to "Image of")
+
# The text to show in the tooltip, when hovering the image (no parameter name but text is case sensitive, defaults to "Image of <nowiki>{{PAGENAME}}</nowiki>")
* '''nocat''': Whether or not to suppress categorization in case of a nonexisting file (defaults to false, which means auto categorization).
+
* '''nocat''': Whether or not to suppress categorization in case of any invalid image (defaults to false, which means auto categorization).
  
'''''NOte''': Both filenames of nonexisting files and files that don't have a description page yet, will result in the default image to be displayed instead.''
+
 
 +
'''''Note''': Both filenames of nonexisting files and of files that don't have a description page yet, will result in the default image to be displayed instead.''
  
 
==Syntax==
 
==Syntax==
Line 18: Line 36:
  
 
==Examples==
 
==Examples==
Common use of the articleimage include both the filename and text parameters:
+
Common use includes both the filename and text parameters:
  <nowiki>{{articleimage|Twinsen.jpg|This is an image for article:}}</nowiki>
+
  <nowiki>{{articleimage|Twinsen.jpg|This is an image for: {{PAGENAME}}}}</nowiki>
 +
 
 +
:[[Image:Twinsen.jpg|frameless|center|This is an image for: {{PAGENAME}}]](hover the image to see the tooltip)
 +
 
 +
 
 +
When a nonexisting file is specified (which raises the [[:Category:Articles with a missing image|Articles with a missing image]] maintenanance task), a default image is displayed with error information in the tooltip:
 +
<nowiki>{{articleimage|My Nonexisting Image.png|This is an image for article: {{PAGENAME}}}}</nowiki>
  
:[[Image:Twinsen.jpg|This is an image for: {{PAGENAME}}]]
+
:[[Image:Divers.gif|frameless|center|The image &quot;My Nonexisting Image.png&quot; is missing or has no description page]](hover the image to see the tooltip)
  
  
When a nonexisting file is specified, this is what would happen:
+
When no file is specified at all, is empty or is left out (which raises the [[:Category:Articles without an image|Articles without an image]] maintenance task), a default image is displayed with error information in the tooltip as well:
  <nowiki>{{articleimage|My Article Image.png|This is an image for article:}}</nowiki>
+
  <nowiki>{{articleimage|This is an image for article: {{PAGENAME}}}}</nowiki>
  
:[[Image:Divers.gif|This is an image for: {{PAGENAME}} (missing)]]
+
:[[Image:Divers.gif|frameless|center|No image was specified for this article]](hover the image to see the tooltip)
  
  
 
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
 
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
  <nowiki>{{articleimage|My Article Image.png|This is an image for article:|nocat=true}}</nowiki>
+
  <nowiki>{{articleimage|This is an image for article: {{PAGENAME}}|nocat=true}}</nowiki>
  
(this would render the same result as the error example above, but would not categorize under [[:Category:Articles without an image]])
+
This would render the same result as the last example above, but would not categorize under [[:Category:Articles without an image]]. This feature works on both maintenance tasks mentioned above.
  
[[Category:System Templates]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 20:24, 4 June 2014

Articleimage
Purpose

Infobox [list all]

Single tag

No [list all]

Multi-line

Yes [list all]

Protected

No [list all]

Game related

No [list all]

Categorization
Suppressible

No [list all]

Choice

Single category [list all]

Categories

Multiple: [list all]

Variables
Names

One: [list all]

Subpages

This template makes it easier to add an image to an article, that automatically displays a default image when incorrect. This also automatically categorizes the article under Category:Articles with a missing image when the specified image doesn't exist, or under Category:Articles without an image when no image or an empty value was given.

Parameters

  1. The filename of an image from Category:Images or a subcategory (no parameter name but filename is case sensitive, defaults to an empty image)
  2. The text to show in the tooltip, when hovering the image (no parameter name but text is case sensitive, defaults to "Image of {{PAGENAME}}")
  • nocat: Whether or not to suppress categorization in case of any invalid image (defaults to false, which means auto categorization).


Note: Both filenames of nonexisting files and of files that don't have a description page yet, will result in the default image to be displayed instead.

Syntax

{{articleimage|filename|text}}

Examples

Common use includes both the filename and text parameters:

{{articleimage|Twinsen.jpg|This is an image for: {{PAGENAME}}}}
This is an image for: Articleimage
(hover the image to see the tooltip)


When a nonexisting file is specified (which raises the Articles with a missing image maintenanance task), a default image is displayed with error information in the tooltip:

{{articleimage|My Nonexisting Image.png|This is an image for article: {{PAGENAME}}}}
The image "My Nonexisting Image.png" is missing or has no description page
(hover the image to see the tooltip)


When no file is specified at all, is empty or is left out (which raises the Articles without an image maintenance task), a default image is displayed with error information in the tooltip as well:

{{articleimage|This is an image for article: {{PAGENAME}}}}
No image was specified for this article
(hover the image to see the tooltip)


The nocat parameter may be used to suppress automatic categorization like this (any value will do):

{{articleimage|This is an image for article: {{PAGENAME}}|nocat=true}}

This would render the same result as the last example above, but would not categorize under Category:Articles without an image. This feature works on both maintenance tasks mentioned above.