Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Incubator escapee wiki:Extended image syntax
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{pp-semi-protected|small=yes}} {{subcat guideline|editing guideline|Extended image syntax|WP:EIS}} This editing guideline documents the syntax used to insert pictures and other media files into Wikipedia pages. The same syntax is used regardless of whether a file is from Wikipedia or [[Wikimedia Commons]]. New editors are encouraged to also see the '''[[Help:Pictures|picture tutorial]]''' and the '''[[Help:Introduction to images with Wiki Markup/1|simple guide for beginners]]'''. ==Brief syntax== In brief, the [[Syntax (programming languages)|syntax]] for displaying an image is: :<code><nowiki>[[File:</nowiki>'''''Name'''''|'''''Type'''''<wbr>|'''''Border'''''<wbr>|'''''Location'''''<wbr>|'''''Alignment'''''<wbr>|'''''Size'''''<wbr>|link='''''Link'''''<wbr>|alt='''''Alt'''''<wbr>|page='''''Page'''''<wbr>|lang='''''Langtag'''''<wbr>|'''''Caption'''''<nowiki>]]</nowiki></code>. <code>Plain type</code> means you always type exactly what you see. <code>'''''Bold italics'''''</code> represent a variable, which you replace with its actual value. Of the parameters shown, only '''''Name''''' is essential. Most images should use <code><nowiki>[[File:</nowiki>'''''Name'''''|thumb|alt='''''Alt'''''|'''''Caption''''']]</code> and not specify a size. The other details: * are optional and * can be placed in any order, except for '''''Caption''''' that has to be the last parameter. ; ''Type'' : <code>thumb</code> (or <code>thumbnail</code>; either can be followed by <code>=<var>'''[[#filename|filename]]'''</var></code>), <code>frame</code> (or <code>framed</code>), or <code>frameless</code>. Displays the image with specific formatting (see below). ; ''Border'' : <code>border</code>. Put a small border around the image. ; ''Location'' : <code>right</code>, <code>left</code>, <code>center</code> or <code>none</code>. Determine the horizontal placement of the image on the page. This defaults to <code>right</code> for thumbnails and framed images. ; ''Alignment'' : <code>baseline</code>, <code>middle</code>, <code>sub</code>, <code>super</code>, <code>text-top</code>, <code>text-bottom</code>, <code>top</code>, or <code>bottom</code>. Vertically align the image with respect to adjacent text. This defaults to <code>middle</code>. ; ''Size'' : <code>upright</code> or <code>upright=<var>'''scaling factor'''</var></code>. Scale a thumbnail from its default size by the given factor (default 0.75), rounding the result to the nearest multiple of 10 pixels. The <code>upright</code> option must be used along with the <code>thumb</code> or <code>frameless</code> parameter. Alternatively, and only where absolutely necessary, users' preferences may be disregarded and the size of the image fixed by specifying a size in pixels: <code>'''''Width''''' px</code> or <code>x '''''Height''''' px</code> or <code>'''''Width''''' x '''''Height''''' px</code>. Scale the image to be no greater than the given width or height, keeping its aspect ratio. Scaling up (i.e. stretching the image to a greater size) is disabled when the image is framed. ; ''Link'' : Link the image to a different resource, or to nothing. ; ''Alt'' : Specify the [[alt attribute|alt text]] for the image. This is intended for visually impaired readers. See [[WP:ALT]] for how this should typically differ from the caption. ; ''Page'': Specify a page other than 1 to use for the thumbnail image in multipaged files. ; ''Langtag'' : Specify the [[IETF language tag]] (slang: langtag) for <code>switch</code>-translated [[SVG]] (Scalable Vector Graphics) files. Some SVG files are multilingual; this parameter specifies which language to use. The langtag should be all lowercase (e.g., <code>zh-hans</code> rather than <code>zh-Hans</code>). Defaults to current Wikipedia language in article namespace or <code>en</code> in other namespaces. See {{tl2|sister=Commons:|Translate}}. ; ''Caption'' : Not a keyword, the actual caption text. Must be last option. This is visible if the <code>thumb</code> or <code>frame</code> attribute is used, but may be displayed on [[mouseover]] in other cases. ==Detailed syntax== The image syntax begins with <code><nowiki>[[</nowiki></code>, contains components separated by <code>|</code>, and ends with <code><nowiki>]]</nowiki></code>. The <code><nowiki>[[</nowiki></code> and the first <code>|</code> (or, if there is no <code>|</code>, the terminating <code><nowiki>]]</nowiki></code>) must be on the same line; other spaces and line breaks {{tag|br|o}} (or {{tag|br|s}}) are ignored if they are next to <code>|</code> characters or just inside the brackets. Spaces or line breaks are not allowed just before the <code>=</code> in the following options, and may have undesirable side effects if they appear just after the <code>=</code>. Do not terminate with the code <code style="color: #a00">|]]</code>; this will be taken as an ''empty'' caption and override any ''real'' caption before it. ===Type=== One of these options may be specified to control whether or not the image is scaled and/or given a border. For options that automatically scale the image, it's usually to 220px; logged-in users can modify this (at "Thumbnail size" under {{myprefs|Appearance|Files}}). This is important to users with (e.g.) limited vision. If this is too large or small the [[#Size|upright attribute]] can be used. Specifying a fixed size in pixels overrides all of this, but is unfriendly to users who need a larger image. ; {{anchor|filename}}<code>thumb</code> (or '''<code>thumbnail</code>''') : Automatically scale the image, and put a box around it. Show a caption if specified. '''Float''' the image on the '''right''' unless overridden with the [[#Location|location attribute]]. With an operand, e.g. <code>thumb=Example.png</code>, the operand names an image that is used as the thumbnail, ignoring any size specification. ; <code>frame</code> : Preserve the original image size, and put a box around the image. Show any caption below the image. '''Float''' the image on the '''right''' unless overridden with the location attribute. <small> Note: Any size options specified will be ignored and flagged as a 'bogus file option' by the Linter.</small> ; <code>frameless</code> : Automatically scale the image up or down. Place it '''inline''' with the text unless overridden with the location attribute. ; Nothing specified : Preserve the original image size, and do not add a border around the image. Place it '''inline''' with the text unless overridden with the location attribute. Do not show a caption. If no alt text is specifically requested, use the requested caption as alt text. This option is almost exclusively used in templates. ===Border=== ; <code>border</code> : Generate a one-pixel border around the image. This has an effect only around unframed images (those without {{para||thumb}} and {{para||frame}}), as framed images always have borders. ===Location=== One of these options may be specified to control the position of the image. For examples of how all this works, see [[#New syntax for images|Examples of location parameter]]. ; <code>right</code> : Place the image on the right side of the page. The article text that follows the image '''flows''' around the image. This is the default when <code>thumb</code> or <code>frame</code> is used. ; <code>left</code> : Place the image on the left side of the page. The article text that follows the image '''flows''' around the image, but there may be formatting issues with lists and indented text (see {{section link||Interaction between left-floating images and lists}}). ; <code>center</code> : Place the image in the center of the page. The article text that follows the image is placed '''below''' the image. ; <code>none</code> : Place the image on the left side of the page. The article text that follows the image is placed '''below''' the image. ; Nothing specified, and neither <code>thumb</code> nor <code>frame</code> : The image is placed '''inline''' with the text, [[File:Face-smile.svg|18px|alt=smiling emoji]] like this. <!-- The order (place/location) of the emoji is intentional, to make it clear that the image is inline ( according to user:Redrose64 { Diff.: https://en.wikipedia.org/w/index.php?title=Wikipedia:Extended_image_syntax&oldid=prev&diff=1180015774 } ) --> ===Vertical alignment=== One of these options may optionally be specified to control the vertical alignment of the image with respect to adjacent text.<br /> These vertical alignment options apply only to plain images, which do not cause breaks and are not floated (that is, they do not work with images that need text to flow around them. To make text flow around an image, place the image preceding the text and use the <code>thumb</code> parameter). In the following list, each option's explanation is preceded by what ''[[:File:Flag of Hungary vertical.svg]]'' looks like when aligned using the listed option, using the markup<br /> of <code><nowiki>[[File:Flag of Hungary vertical.svg|</nowiki>''option''<nowiki>|frameless|upright=0.1|link=|alt=]]</nowiki></code> {{div col}} <span style="break-inside:avoid-column;"><code>middle</code>:<br /> [[File:Flag of Hungary vertical.svg|middle|frameless|upright=0.1|link=|alt=]](This is the default.) Align the vertical middle of the image with the baseline of the text plus half the [[x-height]] of the text, so that the image is vertically centered around a lower case "x" in the text.</span> <span style="break-inside:avoid-column;"><code>baseline</code>:<br /> [[File:Flag of Hungary vertical.svg|baseline|frameless|upright=0.1|link=|alt=]]Align the bottom of the image with the [[Baseline (typography)|baseline]] of the text.</span> <span style="break-inside:avoid-column;"><code>sub</code>:<br /> [[File:Flag of Hungary vertical.svg|sub|frameless|upright=0.1|link=|alt=]]Align the bottom of the image to the same level that the bottom of a subscript would be, such as the bottom of the "2" in "X<sub>2</sub>".</span> <span style="break-inside:avoid-column;"><code>super</code>:<br /> [[File:Flag of Hungary vertical.svg|super|frameless|upright=0.1|link=|alt=]]Align the bottom of the image to the same level that the bottom of a superscript would be, such as the bottom of the "2" in "X<sup>2</sup>".</span> <span style="break-inside:avoid-column;"><code>text-top</code>:<br /> [[File:Flag of Hungary vertical.svg|text-top|frameless|upright=0.1|link=|alt=]]Align the top of the image to the top of the text. This is often a bit higher than the top of a capital letter, because of [[Ascender (typography)|ascenders]] in letters like lower-case "h".</span> <span style="break-inside:avoid-column;"><code>text-bottom</code>:<br /> [[File:Flag of Hungary vertical.svg|text-bottom|frameless|upright=0.1|link=|alt=]]Align the bottom of the image to the bottom of the text. This is somewhat lower than the baseline, because of [[descender]]s in letters like lower-case "y".</span> <span style="break-inside:avoid-column;"><code>top</code>:<br /> [[File:Flag of Hungary vertical.svg|top|frameless|upright=0.1|link=|alt=]]Align the top of the image to the top of the line containing the text. Normally this is slightly higher than the top of the text, to make space between lines of text.</span> <span style="break-inside:avoid-column;"><code>bottom</code>:<br /> [[File:Flag of Hungary vertical.svg|bottom|frameless|upright=0.1|link=|alt=]]Align the bottom of the image to the bottom of the line containing the text. Normally this is slightly lower than the bottom of the text.</span> {{div col end}} ===Size=== {{Shortcut|WP:PICSIZE}} Any or none of these options may be specified to control the size of the image. In the case of images with captions, if the image is already smaller than the requested size, then the image retains its original size (it is not enlarged). In the case of images without captions, the image will be enlarged or reduced to match the requested size. Sizing is disabled when the [[#Type|type 'frame']] is use, with the size options being flagged as a [[Special:LintErrors/bogus-image-options|bogus file option]] at [[:Special:LintErrors]]. The default thumbnail width can be set in the preferences, so '''specifying in px is not recommended''' in order to respect the users' preferences, which may be important for accessibility. Exceptions can, of course, be made, but do try to use <code>upright</code> or the default if possible. {{collapse|2=Implementation details|float=right|1= {{anchor|Implementation details}} Specifying a size does not just change the apparent image size using HTML; it actually generates a resized version of the image on the fly and links to it appropriately. This happens whether or not you specify the size in conjunction with "thumb". This means the server does all the work of changing the image size, not the web browser of the user. Having the server do all the work means faster downloading of pages. It also means that larger images can be stored on the server without any slowdown by the browser (especially on dial up telephone lines). Only the data for the actual size on the page is transmitted. An exception is animated GIF images. Animated GIF images are not processed by the server. When a smaller size is specified the original full sized animated GIF image is served. Whether the animated GIF image is subsequently scaled to fit the allotted space belongs to the capabilities of the receiving browser. Resizing an animated GIF image will significantly reduce its quality, without any reduction of download time. When there are two or more "size" options of the same type, only the last one is valid. However, if both an upright and an absolute size are used together, the absolute size always takes precedence, regardless of where it appears in the options. }} ; ''(nothing specified)'' : For thumbnails, use the size specified in preferences for logged in users, and use a size determined by resolution for users who are not logged in. For non-thumbnails, use the native size of the image. ; <code>upright</code> {{nobold|or}} <code>upright=</code>''scaling factor'' : Scale a thumbnail's size to ''scaling factor'' times the default thumbnail size, rounding the result to the nearest multiple of 10. For instance, <code>upright=1.5</code> makes the image larger, which is useful for maps or schematics that need to be larger to be readable. The parameter <code>upright=1</code> returns the same size as thumbnail width, and <code>upright=0.75</code> is functionally identical to <code>upright</code> alone. If you set ''scaling factor'' equal to the image's aspect ratio (width divided by height) the result is equivalent to scaling the height to be equal to the normal thumbnail width. : The <code>upright</code> option only works with the <code>thumb</code> or <code>frameless</code> parameter (see [[#Type|Type]]). ; ''Width''<code>px</code> : (''E.g.'' <code>100px</code>) Scale the image to make it the specified number of pixels in width, and scale the height to retain the original aspect ratio. ; <code>x</code>''Height''<code>px</code> : (''E.g.'', <code>x150px</code>) Scale the image to make it the specified number of pixels in height, and scale the width to retain the original aspect ratio. ; ''Width''<code>x</code>''Height''<code>px</code> : (''E.g.'' <code>100x150px</code>) Scale the image to be no wider and no higher than the specified number of pixels. The image '''will keep''' its original aspect ratio. ===Link=== {{see also|Wikipedia:Images linking to articles}} ; {{para|link|<var>Page</var>}} : Ordinarily, clicking on an image takes the reader to the [[Help:Image page|image description page]]. The link option allows the reader to be taken instead to a different page, such as a fuller image from which the thumbnail was cropped, or to a full document of which the thumbnail was a single page (or crop of a single page). Do not enclose the page name in square brackets. If <var>Page</var> is a URL, the reader will be taken outside the project; this is not normally done in article space. ; {{para|link}} (alone): Disables the link so that clicking on the image does nothing. {{para|link}} affects only what happens when the ''image itself'' is clicked; {{para||thumb}} images carry a little rectangle-rectangle icon [[File:Magnify-clip.svg|15px|link=]] in the caption area, and clicking that always leads to the image description page. Except for public-domain images, it must always be possible for the reader to reach the image-description page, so {{para|link}} should be used only with {{para||thumb}} images. {{para|link}} cannot be used with {{para||frame}}. To disable all linking from, and description of, a [[Wikipedia:Manual of Style/Accessibility/Alternative text for images#Decorative images|purely decorative image]]{{snd}}so that it's ignored by screen readers{{snd}}use "{{para|link}}{{para|alt}}" with no arguments for either parameter. ===Alt text and caption=== Zero or more of these options may be specified to control the ''alt text'', ''link title'', and ''caption'' for the image. Captions may contain embedded wiki markup, such as links or formatting. See [[Wikipedia:Captions]] for discussion of appropriate caption text. See [[Wikipedia:Alternative text for images]] for discussion of appropriate alt text. Internet Explorer displays the link title as a tooltip but other browsers may not.{{Update inline|date=June 2024|reason=Internet Explorer is obsolete.}} Hint: to force the caption to be written (underneath the picture) and not just appear as "hover text" even when you wish to resize the image, specify "<code>thumb</code>". If you specify "<code>frame</code>" the caption does appear but any resizing (such as "<code>125px</code>") is ignored. ; <code>alt=</code>''Alt'': Use '''''Alt''''' as the alt text for the image. ; ''Caption'': (the last option that is not recognised as some other part of the image syntax): How this text is used depends on the image type. When the type has a visible caption ("<code>thumbnail</code>", "<code>thumb</code>", "<code>frame</code>" or "<code>framed</code>") then this text appears as a caption below the image. Otherwise, (if the image type is unspecified or is "<code>frameless</code>"), this text is used for the link title provided the link has not been suppressed with "<code>|link=</code>", and also for the alt text provided an explicit <code>alt=</code>'''''Alt''''' has not been supplied. The actual alt text for the displayed image will be one of the following, in order of preference: # The explicitly requested '''''Alt''''', if any; # The explicitly requested '''''Caption''''', if the image type has no visible caption; # The empty string, if there is an explicitly requested '''''Caption''''' and the image type has a visible caption. # The image file name if there is no explicitly requested '''''Alt''''' or '''''Caption'''''. This is never a satisfactory option. It is possible to specify the link title text only for images with no visible caption (as described above). However, as not all browsers display this text, and it is ignored by screen readers, there is little point. '''Note:''' <code>alt</code> is supported only for images. Audio and video files should use [[Wikipedia:Manual_of_Style/Accessibility#Video|timed text]]. ===Class=== ; <code>class=</code> : Used to insert any HTML classes for image. This has an effect only for classes listed specifically in [[Wikipedia:Catalogue of CSS classes]], or some classes produced by [[Wikipedia:TemplateStyles|TemplateStyles]]. *The special class <code>class=notpageimage</code> will exclude the image from being selected by the [[:mw:Extension:PageImages|Page Images]] algorithm.<sup>([[phab:T301588]])</sup> *<code>class=skin-invert</code> will cause the image's colors to be inverted in [[mw:Reading/Web/Accessibility for reading/Updates/2024-04|dark mode]]. <code>class=skin-invert-image</code> will only invert the image and not the caption. *Separate multiple classes with spaces, e.g. <code>class=skin-invert-image notpageimage</code> ===Page=== [[File:IMSLP01578-Ravel - Bolero Full Score Durand 1929.pdf|thumb|page=2|''Boléro'': page 2 from the score]] Normally page 1 from a PDF or DjVu file is used to generate the thumbnail. A different page can be used with the parameter {{para|page}}: <syntaxhighlight lang="wikitext" inline>[[File:IMSLP01578-Ravel - Bolero Full Score Durand 1929.pdf|thumb|page=2|''Boléro'': page 2 from the score]]</syntaxhighlight>: {{clear|right}} ==Examples== {{dablink|Note: This section does not display properly on the mobile version of Wikipedia }} ===Using the basic syntax=== The most basic example uses the syntax <syntaxhighlight lang="wikitext" inline>[[File:Westminstpalace.jpg|Alt text]]</syntaxhighlight>. This does not scale the image or allow text to wrap around it. This is not normally appropriate in an article. [[File:Westminstpalace.jpg|Alt text]] This is rendered inline, and the specified text is used as the image's ''alt'' attribute (alternate text for programs which cannot display images, such as [[screen reader]]s) and as the ''title'' attribute (supplementary text, often displayed as a tooltip when the mouse is over the image). See [[Wikipedia:Captions]] for discussion of appropriate caption text. See [[Wikipedia:Alternative text for images]] for discussion of appropriate alt text. Above, the image of the Thames was put into its own paragraph. This isn't mandatory; images can sit inline in text, as shown below. <syntaxhighlight lang="wikitext" style="overflow:auto;"> text text text text text text [[File:Westminstpalace.jpg|150px|alt=A large clock tower and other buildings line a great river.|The Palace of Westminster]] text text text text text [[File:tst.png|100px|alt=Tiny globe|This is a globe.]] text text text text </syntaxhighlight> gives text text text text text text [[File:Westminstpalace.jpg|150px|alt=A large clock tower and other buildings line a great river.|The Palace of Westminster]] text text text text text [[File:tst.png|100px|alt=Tiny globe|This is a globe.]] text text text text ===Keeping the original size, with a caption=== To display an image as uploaded with a caption use <code><nowiki>[[File:Westminstpalace.jpg|frame|none|alt=Alt text|Caption text]]</nowiki></code>. [[File:Westminstpalace.jpg|frame|none|alt=Alt text|Caption text]] ===Aligning thumbnails to fit into text=== {{anchor|New syntax for images}} [[File:Westminstpalace.jpg|thumb|upright=0.4|left|alt=A large clock tower and other buildings line a great river.|The Palace of Westminster]] This is the style most familiar to readers. As shown on in the example image, the image is framed, is an appropriate size, and has text able to wrap around it. A caption is properly integrated. The important part of this is the <code>thumb</code> parameter: <code><nowiki>[[File:Westminstpalace.jpg|</nowiki>'''thumb'''|upright=0.4|left|alt=A large clock tower and other buildings line a great river.|The Palace of Westminster]]</code> (as shown in the left). For details of these options, see previous sections. Examples of the location parameter are below: {{clear}} <div style="display:flex; flex-flow: row wrap; text-align: left;"> {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 38em;|2=div|1= '''right'''<br> [[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|right|upright=0.35]]The image is right-aligned, and text floats to the left of the image: <code><nowiki>[[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|</nowiki>'''right'''<nowiki>|upright=0.35]]</nowiki></code> (shown on the right).{{clr}}}} {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 38em;|2=div|1= '''left'''<br> [[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|left|upright=0.35]]The image is left aligned, and text floats to the right of the image: <code><nowiki>[[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|</nowiki>'''left'''<nowiki>|upright=0.35]]</nowiki></code> (shown on the left).{{clr}} }} {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 38em;|2=div|1= '''center'''<br> The image is centered, and... [[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|center|upright=0.35]] the text following the image starts below it: <code><nowiki>[[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|</nowiki>'''center'''<nowiki>|upright=0.35]]</nowiki></code> (shown above).{{clr}} }} {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 38em;|2=div|1= '''none'''<br> The image is put at the left, and... [[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|none|upright=0.35]] the text following does not float to the right (or to the left, obviously), and starts below it: <code><nowiki>[[File:Westminstpalace.jpg|thumb|alt=A large clock tower and other buildings line a great river.|</nowiki>'''none'''<nowiki>|upright=0.35]]</nowiki></code> (shown above).{{clr}} }} </div> ===The many-floating-objects problem=== {{shortcut|WP:MFOP}} {{See also|WP:STACKING}} There is a floating issue in HTML/CSS that prevents certain images (or other floating objects) from floating above others. It occurs only if: * there are multiple floating objects on one side of the page * the floating object on the other side of the page comes '''after''' the other ones in the source code The first floating object on the latter side of the page won't float above the last floating object on the former (see examples below). Solutions include alternating between left and right in aligning images or other floating objects (not shown); setting to "none" the alignment of the one that won't float above the others (as demonstrated on the population table [[Rochefort, Charente-Maritime|here]]); and using a gallery tag for large numbers of images in a single section. Per [[MOS:ACCESS#FLOAT]], images should be inserted in the relevant section (i.e. do not place the markup above the section headline), even if that can cause them to float into the next section. Problematic code: <syntaxhighlight lang="wikitext"> ==Section 1== [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.1 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.2 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.3 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.4 ('''right''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ==Section 2== [[File:Westminstpalace.jpg|thumb|70px|left|Figure 2.1 ('''left''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </syntaxhighlight> <div style="display:flex; flex-flow: row wrap; text-align: left;"> {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 25em;|2=div|1= '''The problem''': {{Fake heading|Section 1}} [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.1 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.2 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.3 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.4 ('''right''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. {{Fake heading|Section 2}} [[File:Westminstpalace.jpg|thumb|70px|left|Figure 2.1 ('''left''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. }} {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 25em;|2=div|1= '''Setting alignment of final image to none''': {{Fake heading|Section 1}} [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.1 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.2 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.3 ('''right''')]] [[File:Westminstpalace.jpg|thumb|70px|right|Figure 1.4 ('''right''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. {{Fake heading|Section 2}} [[File:Westminstpalace.jpg|thumb|70px|none|Figure 2.1 ('''none''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. }} {{Inline block|width=38em|style=border: 1px solid #a2a9b1; padding: 0.5em; margin: 0.5em; flex: 25em;|2=div|1= '''Using gallery tags for large numbers of images''': {{Fake heading|Section 1}} <gallery widths="70px" heights="50px"> Westminstpalace.jpg|Figure 1.1 Westminstpalace.jpg|Figure 1.2 Westminstpalace.jpg|Figure 1.3 Westminstpalace.jpg|Figure 1.4 </gallery> For more information on the gallery tag, see '''[[Help:Gallery tag]]'''. {{Fake heading|Section 2}} [[File:Westminstpalace.jpg|thumb|70px|left|Figure 2.1 ('''left''')]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. }} </div> ===Using "upright"=== [[File:Westminstpalace.jpg|thumbnail|upright|left|alt=A large clock tower and other buildings line a great river.|The "<code>upright</code>" option is about 75% of thumbnail width.]] [[File:Westminstpalace.jpg|thumb|upright=1.5|right|alt=A large clock tower and other buildings line a great river.|The "<code>upright=1.5</code>" option]] The <code>upright</code> option works in combination with the <code>thumbnail</code> or <code>thumb</code> option to resize an image to about 75% of the width of a plain <code>thumbnail</code>. This is useful for displaying images in [[Page orientation|"portrait" orientation]], since such tall and narrow images tend to look too large when scaled to the same width as "landscape" oriented images. The <code>upright</code> option scales larger or smaller in step with user screen resolution. The relative size can be determined with a multiplier such as <code>upright=''x''</code>. If ''x''=1 then the image is standard thumbnail width. ''E.g.'', <syntaxhighlight lang="wikitext" inline>[[File:Westminstpalace.jpg|thumbnail|upright|left|alt=A large clock tower and other buildings line a great river.|The "<code>upright</code>" option is about 75% of thumbnail width.]]</syntaxhighlight> (shown on the left) and <syntaxhighlight lang="wikitext" inline>[[File:Westminstpalace.jpg|thumb|upright=1.5|right|alt=A large clock tower and other buildings line a great river.|The "<code>upright=1.5</code>" option]]</syntaxhighlight> (shown on the right). {{clr}} ===Using frame=== [[File:Westminstpalace.jpg|frame|alt=A large clock tower and other buildings line a great river.|The Palace of Westminster]] With this option, the embedded image is shown with its actual size enclosed by a frame, regardless of the "thumb" or "size" attribute, and the caption, if any, is visible in the frame. Without the options <code>left</code>, <code>center</code>, and <code>none</code>, the image is normally on the right: <code><nowiki>[[File:Westminstpalace.jpg|frame|alt=A large clock tower and other buildings line a great river.|The Palace of Westminster]]</nowiki></code>.{{clr}} With none of the options other than <code>''size''px</code> and <code>''alternate (caption) text''</code>, an embedded image is rendered inline. ===Using alignment "none" thumbnails in tables=== The option <code>none</code> can be used to have thumbnails without left- or right-alignment. This is probably most useful for [[Wikipedia:How to use tables|tables]]. This is an example: {| class="wikitable" |+ London's palaces |- | Palace of Westminster || [[File:Westminstpalace.jpg|thumb|none|100px|alt=A large clock tower and other buildings line a great river.|From the Thames]] || <code><nowiki>[[File:Westminstpalace.jpg|thumb|none|100px|alt=A large clock tower and other buildings line a great river.|From the Thames]]</nowiki></code> |- | Buckingham Palace || [[File:Buckingham Palace 2003.jpg|thumb|none|100px|alt=Grand city building below beautiful blue sky and clouds|Queen's home]] || <code><nowiki>[[File:Buckingham Palace 2003.jpg|thumb|none|100px|alt=Grand city building below beautiful blue sky and clouds|Queen's home]]</nowiki></code> |} ===Formatting and links in captions=== [[File:Westminstpalace.jpg|right|thumbnail|alt=A large clock tower and other buildings line a great river.|This is the [[Palace of Westminster]] in London]] You can put links in the caption text, as demonstrated in this image: <syntaxhighlight lang="wikitext">[[File:Westminstpalace.jpg|right|thumbnail|alt=A large clock tower and other buildings line a great river.|This is the [[Palace of Westminster]] in London]]</syntaxhighlight> Just make sure the number of opening and closing square brackets are right. One extra or missing would mean the entire image syntax line would not work. {{clear}} [[File:Westminstpalace.jpg|right|thumbnail|alt=A large clock tower and other buildings line a great river.|<div style="text-align: center">This is <span style="color: green">the </span><br /> [[Palace of Westminster]]<br /> '''in <span style="color: red">London</span>'''</div>]] Additional caption formatting options are possible; all normal formatting should just work. <syntaxhighlight lang="wikitext">[[File:Westminstpalace.jpg|right|thumbnail|alt=A large clock tower and other buildings line a great river.|<div style="text-align: center">This is <span style="color: green">the </span><br /> [[Palace of Westminster]]<br /> '''in <span style="color: red">London</span>'''</div>]] </syntaxhighlight> {{clear}} === Interaction between left-floating images and lists === {{Shortcut|WP:EISL}} List bullets and numbers can sometimes overlap left-floating images, and indented lines may not appear correctly when next to left-floating images. For example: {{markup | <syntaxhighlight lang="wikitext"> [[File:Westminstpalace.jpg|left|thumb|100px]] <ol> <li>list item A1 <ol> <li>list item B1</li> <li>list item B2</li> </ol>continuing list item A1 </li> <li>list item A2</li> </ol></syntaxhighlight> |[[File:Westminstpalace.jpg|left|thumb|100px]] <ol> <li>list item A1 <ol> <li>list item B1</li> <li>list item B2</li> </ol>continuing list item A1 </li> <li>list item A2</li> </ol> |<syntaxhighlight lang="wikitext"> [[File:Westminstpalace.jpg|left|thumb|100px]] First line :Second line ::Third line :::Fourth line </syntaxhighlight> |[[File:Westminstpalace.jpg|left|thumb|100px]] First line :Second line ::Third line :::Fourth line }} The {{tl|flowlist}} template enables lists to stay clear of these left-floating objects: <syntaxhighlight lang="wikitext"> [[File:Westminstpalace.jpg|left|thumb|100px]] {{flowlist}} <ol> <li>list item A1 <ol> <li>list item B1</li> <li>list item B2</li> </ol>continuing list item A1 </li> <li>list item A2</li> </ol> {{endflowlist}} {{flowlist}} First line :Second line ::Third line :::Fourth line {{endflowlist}} </syntaxhighlight> Renders as: [[File:Westminstpalace.jpg|left|thumb|100px]] {{flowlist}} <ol> <li>list item A1 <ol> <li>list item B1</li> <li>list item B2</li> </ol>continuing list item A1 </li> <li>list item A2</li> </ol> {{endflowlist}} [[File:Westminstpalace.jpg|left|thumb|100px]] {{flowlist}} First line :Second line ::Third line :::Fourth line {{endflowlist}} {{clear}} This method will not work inside of a table, and if your list is longer than the floated element, then the list will not flow around the image like normal, but instead be one block, leaving white space below the floated element. ==Overlaying annotations on an image == {{update|section|part=how this works with Imagemap templates?}} In some cases, it may be desirable to add clickable annotations to an image. The templates [[Template:Annotated image]] and [[Template:Annotated image 4]] exist for this purpose. These templates allow [[wikitext]] (e.g., regular text, wikilinks, allowed HTML code, references, and other templates) to be included on the image itself. They may also be used to crop an image so as to focus on a particular portion of it, or alternatively, expand the white area around an image for better placement of wikitext. {| style="margin: auto;" |+ Annotated image template examples |{{Annotated image | float=none | caption=Example of an annotated diagram (using [[Template:Annotated image]]) that has clickable wikilinks and overlaid text | image=Wiwaxia body zones.png | width=300 | height=110| image-width=150 | image-left=93 | image-top=0 | annotations = {{Annotation|88|25|[[Spine]]}} {{Annotation|150|37|Dorsal}} {{Annotation|58|60|Upper lateral}} {{Annotation|204|70|Lower lateral}} {{Annotation|58|79|Ventro-lateral}} {{Annotation|173|96|<span style{{=}}"background-color:#753a00"> </span> {{=}} Frontal}} }} |{{Annotated image 4 | align=center | caption=Example of an annotated diagram (using [[Template:Annotated image 4]]) that has clickable wikilinks and overlaid text | image=Wiwaxia body zones.png | width=300 | height=116| image-width=150 | image-left=93 | image-top=0 | annotations = {{Annotation|88|25|[[Spine]]}} {{Annotation|150|37|Dorsal}} {{Annotation|58|60|Upper lateral}} {{Annotation|204|70|Lower lateral}} {{Annotation|58|79|Ventro-lateral}} {{Annotation|173|96|<span style{{=}}"background-color:#753a00"> </span> {{=}} Frontal}} }} |[[File:Wiwaxia body zones.png|The image and caption as a thumb, sans annotations|thumb|left]] |}<!-- --> There is also the template {{tl|Overlay}}: {{overlay |image = Stillwell from Pulpit.jpg |columns = 2 |width = 704 |height = 273 |overlay1 = Mount Stillwell |overlay1top = 100 |overlay1left = 350 |overlay2 = Kangaroo Ridge |overlay2top = 108 |overlay2left = 500 |overlay3 = Little Stillwell |overlay3top = 80 |overlay3left = 160 |overlay4 = Kangaroo Ridge Triple Chairlift mid station |overlay4top = 185 |overlay4left = 263 |overlay5 = Basin Poma (J-Bar) unload point |overlay5top = 185 |overlay5left = 395 |overlay6 = Ego flats |overlay6top = 235 |overlay6left = 350 |overlay7 = Snow gums |overlay7link = Snow gum |overlay7top1 = 125 |overlay7left1 = 650 |overlay7top2 = 130 |overlay7left2 = 50 }} Only item 7 is linked here. == Superimposing images == Images can be overlaid or superimposed using {{t|Superimpose}}, {{t|Superimpose2}} or {{t|Overlaid images}}. {{Superimpose | base = US_Locator_Blank.svg | base_width = 288px | base_alt = Located in north central Colorado, which is just west of the center of the U.S. | base_caption = United States Locator Map | float = Red pog.svg | float_width = 10px | x = 95 | y = 80 }} ==Cropping images== Images can be [[Cropping (image)|cropped]] using {{t|CSS image crop}} or {{t|Annotated image}}. {{CSS image crop |Image = Dew on grass Luc Viatour.jpg |bSize = 400 |cWidth = 100 |cHeight = 100 |oTop = 180 |oLeft = 60 |Location = center |Description = A drop of dew on grass (focus on the drop) }} ==Cancelling floating-around-image mode==<!-- This section is linked from [[George Fox]] --> After having had an image floating next to text, putting further text below it (and again using the full width) can be done with the following markup. This blocks an image from appearing next to the material following this markup. The reason for this could be [[aesthetics|aesthetic]] or a change in topics. This can be issued by using template {{tl|clear}} or {{tl|Clr}} or {{tl|-}} in certain namespaces (<em>en</em>, <em>meta</em>). ==VR images== {{shortcut|MOS:360}} To display [[VR photograph]]s ({{abbr|aka|also known as}} 360-degree panoramas or photospheres), use {{tl|PanoViewer}}. ==Linking to the image without displaying it== If you don't want to show or display the image but rather just want to make a link to the description page for an image, use a leading colon before "File:" in an intra-wiki link, like this: <code><nowiki>[[:File:STS-32 crew.jpg|STS-32 crew]]</nowiki></code> which yields: [[:File:STS-32 crew.jpg|STS-32 crew]]. Linking to a particular PDF or DjVu page using the [[#Page|parameter {{para|page}}]] is not supported, so the template {{tlx|PDF page link}} should be used instead. ==Sound files == Often, sound files are presented on Wikipedia pages using {{tl|Listen}} or its related templates. However, it is also possible to present an audio file without using any template. Similar syntax to images can be used to transclude audio or video files into pages. {| class=wikitable ! !!Code!!Output |- |1.||<code><nowiki>[[File:Accordion chords-01.ogg]]</nowiki></code> |[[File:Accordion chords-01.ogg]] |- |2.||<code><nowiki>[[File:Accordion chords-01.ogg|frameless|upright=1.3]]</nowiki></code> |[[File:Accordion chords-01.ogg|frameless|upright=1.3]] |} Note that none of these examples provide links to [[Wikipedia:Media help]], and example 2 provides no navigable links to the file itself. Consequently, whenever this method is used, the {{tl|Inline audio}} template must be shown on that page, and the presentation of the play buttons must be accompanied by clickable links to the sound file itself. Examples: {| class=wikitable ! !!Code!!Output |- |1.||<code><nowiki>[[File:Accordion chords-01.ogg|frameless|upright=0.4|left]] [[:File:Accordion chords-01.ogg|Accordion chords]]</nowiki></code> |[[File:Accordion chords-01.ogg|frameless|upright=0.4|left]] [[:File:Accordion chords-01.ogg|Accordion chords]] |- |2.||<code><nowiki>[[:File:Accordion chords-01.ogg|Accordion chords]] [[File:Accordion chords-01.ogg|90px|right]]</nowiki></code> |[[:File:Accordion chords-01.ogg|Accordion chords]] [[File:Accordion chords-01.ogg|90px|right]] |- |3.||<code><nowiki>[[:File:Accordion chords-01.ogg|Accordion chords]] [[File:Accordion chords-01.ogg|90px]]</nowiki></code> |[[:File:Accordion chords-01.ogg|Accordion chords]] [[File:Accordion chords-01.ogg|90px]] |} Note that vertical alignment of the play button does not work, nor is it possible to present the play button inline with text; consequently, the most pleasing arrangement is achieved with examples 1 or 3. There is also a parameter to preset the player to start at a time other than 0:00. {| class=wikitable ! !!Code!!Output |- |1.||<code><nowiki>[[File:Accordion chords-01.ogg|start=0:05]]</nowiki></code> |[[File:Accordion chords-01.ogg|start=0:05]] |} ===MIDI=== Since June 2019, MIDI files can be played just like other sound files. See: [[Help:Score]]. [[File:Beethoven Op. 33 no. 1.mid|thumb|[[Bagatelles, Op. 33 (Beethoven)|''Bagatelles'', Op. 33]], no. 1]] <syntaxhighlight lang="wikitext">[[File:Beethoven Op. 33 no. 1.mid|thumb|[[Bagatelles, Op. 33 (Beethoven)|''Bagatelles'', Op. 33]], no. 1]]</syntaxhighlight> ==Video files== To display a video as uploaded with a caption use <code><nowiki>[[File:First flights in aviation history.ogg|frame|none|Caption text]]</nowiki></code>. [[File:First flights in aviation history.ogg|frame|none|Caption text]] === Initial still image=== "<code>|thumbtime='''Time'''</code>". Use the frame from the video at the given time as the initial still image. '''Time''' is either a number of seconds, or hours, minutes and seconds separated by colons. Without a thumbtime parameter, a frame from the midpoint of the video is used by default. For instance, using the same video file as previously: {| |- |valign="top"|[[File:First flights in aviation history.ogg|thumb|thumbtime=21|Man in suit tie and hat at 21 seconds. Time syntax using seconds only: "21".]] |- |valign="top"|[[File:First flights in aviation history.ogg|thumb|thumbtime=0:23|Monoplane seen at 23 seconds. Time syntax using minutes and seconds: "0:23".]] |- |valign="top"|[[File:First flights in aviation history.ogg|thumb|thumbtime=0:0:33|Landed biplane seen at 33 seconds. Time syntax using hours, minutes and seconds: "0:0:33".]] |} ===Temporal media fragments=== [[File:Weeding.ogv|thumb|upright=1.3|start=5|end=7|Starts at 5 seconds and ends playback at 7 seconds]] This syntax allows you to play a segment of the video stream or set a start time. Hover over the player to see start time listed as 5s, press play and notice it stops playback at 7 seconds. : <code><nowiki>[[File:Weeding.ogv|thumb|upright=1.3|start=5|end=7|Starts at 5 seconds and ends playback at 7 seconds]]</nowiki></code> '''Note:''' This is not yet supported by Safari and Internet Explorer. ===Displaying small videos larger=== To display a video larger than its uploaded size use "'''<code>|thumb</code>'''" and "'''<code>|''number''px</code>'''". This may be useful if the original video is very small but shows some important but small detail, but note that upscaling may create unexpected scaling artifacts. For example, the code <code><nowiki>[[File:cal16x16check_vdnocnoafr1len2.avi.q10.ogv|inline|left]] [[File:cal16x16check_vdnocnoafr1len2.avi.q10.ogv|right|thumb|128px]]</nowiki></code> : displays the 16 pixels wide video at its original size on the left and eight times wider at the right (the squares should be all black or all white and the edges should be sharp — any blurriness or off-white colour is likely due to the browser or the Wikimedia server rendering): {|align="center" width="80%" |[[File:cal16x16check_vdnocnoafr1len2.avi.q10.ogv|inline|left]] [[File:cal16x16check_vdnocnoafr1len2.avi.q10.ogv|right|thumb|128px]] |} ===Thumbtime in a gallery=== The ''thumbtime'' parameter can also be used inside a gallery (either with [[Help:Gallery tag|<gallery> tags]] or the {{tl|Gallery}} template): <gallery> File:First flights in aviation history.ogg|thumbtime=21|Man in suit tie and hat at 21 seconds. File:First flights in aviation history.ogg|thumbtime=0:23|Monoplane seen at 23 seconds. </gallery> Here is the wikicode that created it: <pre><gallery> File:First flights in aviation history.ogg|thumbtime=21|Man in suit tie and hat at 21 seconds. File:First flights in aviation history.ogg|thumbtime=0:23|Monoplane seen at 23 seconds. </gallery></pre> ==See also== * [[Wikipedia:Images]] – For an overview of images in Wikipedia * [[Help:Pictures]] * [[Wikipedia:Picture tutorial]] * [[Wikimedia Commons]] ([[:commons:Main Page|Commons Main Page]]), a free [[multimedia]] [[Digital library|repository]], that you can use directly in Wikipedia and the other [[Wikimedia Foundation|Wikimedia project]]s. You can [[upload]] new images or use the stored ones. * [[Commons:Commons:Video]] – Outline of videos on Commons; using, playing, policy, finding, converting and uploading * [[Wikipedia:Creation and usage of media files]] – A how-to guide, old but still useful * [[Wikipedia:Image use policy]] * [[Wikipedia:Image markup with HTML]] – How to add images to articles, old school. Obsolete but interesting. * [[Wikipedia:Finding images tutorial]] * [[meta:Help:Images and other uploaded files]] * [[mw:Extension:PagedTiffHandler]] – <code>lossy</code> parameter for tiff files {{Wikipedia technical help|collapsed}} [[Category:Wikipedia image help|Extended image syntax]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Abbr
(
edit
)
Template:Anchor
(
edit
)
Template:Annotated image
(
edit
)
Template:Annotated image 4
(
edit
)
Template:CSS image crop
(
edit
)
Template:Clear
(
edit
)
Template:Clr
(
edit
)
Template:Collapse
(
edit
)
Template:Dablink
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Endflowlist
(
edit
)
Template:Flowlist
(
edit
)
Template:Inline block
(
edit
)
Template:Markup
(
edit
)
Template:Myprefs
(
edit
)
Template:Nobold
(
edit
)
Template:Overlay
(
edit
)
Template:Para
(
edit
)
Template:Pp-semi-protected
(
edit
)
Template:Section link
(
edit
)
Template:See also
(
edit
)
Template:Shortcut
(
edit
)
Template:Snd
(
edit
)
Template:Subcat guideline
(
edit
)
Template:Superimpose
(
edit
)
Template:T
(
edit
)
Template:Tag
(
edit
)
Template:Template link
(
edit
)
Template:Tl
(
edit
)
Template:Tl2
(
edit
)
Template:Tlx
(
edit
)
Template:Update
(
edit
)
Template:Update inline
(
edit
)
Template:Wikipedia technical help
(
edit
)