Template:Main page image: Difference between revisions

From Daniel Larson Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<div class="thumbinner mp-thumb" style="background: transparent; border: none; padding: 0; text-align: center; max-width: {{#expr:{{str number/trim|{{if empty|{{{width|}}}|120}}}}{{#ifeq:{{{border|}}}|yes|+2}}}}px;">
<div class="thumbinner mp-thumb" style="background: transparent; border: none; padding: 0; text-align: center; min-width: 100px; max-width: {{#expr:{{str number/trim|{{if empty|{{{width|}}}|120}}}}{{#ifeq:{{{border|}}}|yes|+2}}}}px;">
[[File:<!--if {{{image}}} begins with File:/Image: remove it-->{{PAGENAME:{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}{{#ifeq:{{{border|}}}|yes|{{!}}border|}}|<!-- if {{{width}}} ends with "px" then remove it -->{{Str rep|{{#invoke:string|replace|{{#if:{{{width|}}}|{{{width}}}|120}}|px$||plain=false}}px|-nanpx|frameless}}<!-- title (use caption, alt text or non-default link target if not available) -->{{#if:{{{title|}}} | {{!}}{{{title}}} | {{#if:{{{caption|{{{2|}}}}}} | {{!}}{{{caption|{{{2|}}}}}} | {{!}}{{{alt|}}}}}}} <!-- alt text (use caption, title or image name if not available) --> {{#if:{{{alt|}}} | {{!}}alt={{{alt}}}}} <!--add link if exists-->{{#if:{{{link|}}} | {{#ifeq:{{PAGENAME:{{{link}}}}}|{{PAGENAME:{{{image}}}}}| <!--do nothing if {{{link}}} and {{{image}}} are the same-->| {{!}}link=File:{{PAGENAME:{{{link}}}}} }}<!--end #ifeq for link/image comparison--> }}<!--end #if for link-->{{#if:
[[File:<!--if {{{image}}} begins with File:/Image: remove it-->{{PAGENAME:{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}{{#ifeq:{{{border|}}}|yes|{{!}}border|}}|<!-- if {{{width}}} ends with "px" then remove it -->{{Str rep|{{#invoke:string|replace|{{#if:{{{width|}}}|{{{width}}}|120}}|px$||plain=false}}px|-nanpx|frameless}}<!-- title (use caption, alt text or non-default link target if not available) -->{{#if:{{{title|}}} | {{!}}{{{title}}} | {{#if:{{{caption|{{{2|}}}}}} | {{!}}{{{caption|{{{2|}}}}}} | {{!}}{{{alt|}}}}}}} <!-- alt text (use caption, title or image name if not available) --> {{#if:{{{alt|}}} | {{!}}alt={{{alt}}}}} <!--add link if exists-->{{#if:{{{link|}}} | {{#ifeq:{{PAGENAME:{{{link}}}}}|{{PAGENAME:{{{image}}}}}| <!--do nothing if {{{link}}} and {{{image}}} are the same-->| {{!}}link=File:{{PAGENAME:{{{link}}}}} }}<!--end #ifeq for link/image comparison--> }}<!--end #if for link-->{{#if:
{{{thumbtime|}}} | {{!}}thumbtime={{{thumbtime}}} }}]]{{#if: {{{caption|{{{2|<noinclude>Caption goes here.</noinclude>}}}}}}|
{{{thumbtime|}}} | {{!}}thumbtime={{{thumbtime}}} }}]]{{#if: {{{caption|{{{2|<noinclude>Caption goes here.</noinclude>}}}}}}|

Revision as of 06:06, 19 March 2024

Example-serious.jpg
Caption goes here.


Template:Documentation subpage This template is used on the Main Page to show an image or media file with a caption underneath.

Usage

Note: Prefer images in landscape orientation. If you must use one in portrait orientation, avoid very skinny ones. If you must choose a skinny image, then please specify the height as well (e.g., 120x120), but note that if you do so, there will be a gap between left or right edge of the image (depending on the what side of the container the template appears) and the edge of the section.

{{Main page image
| image         =  <!-- name of the file, with or without the File: prefix -->
| link          =  <!-- optional: file to which you want the image to link, with or without the File: prefix -->
| border        =  <!-- optional: "yes" for a border; defaults to no border -->
| width         =  <!-- optional: width of image in pixels, with or without "px"; defaults to 120; can also use 120x120 syntax -->
| caption       =  <!-- optional: wiki text -->
| caption align =  <!-- optional: left, right, or center; defaults to left -->
| title         =  <!-- optional: image title; if blank, will use the caption, alt text, non-default "link=" target, or nothing (in that order) -->
| alt           =  <!-- optional: image alt text; if blank, will use the caption, title, or image name (in that order) -->
| thumbtime     =  <!-- optional: number of seconds into the video depicted in the thumbnail -->
}}

See also

Template:Sandbox other