WikiQueer:Extended image syntax

In brief, the syntax for displaying an image is (see Multimedia syntax below for extra syntax for sound and multimedia files):


 * Name Type Border Location Alignment Size Link Alt Caption

Only Name is required. Most images should use " Name Alt Caption " and should not specify a size. The other details are optional and can be placed in any order.


 * Type : " " (or " "; either can be followed by " "), " " (or " "), or " ". Display the image with specific formatting (see below).
 * Border : " ". Put a small border around the image.
 * Location : " ", " ", " " or " ". Determine the horizontal placement of the image on the page. This defaults to " " for thumbnails.
 * Alignment : " ", " ", " ", " ", " ", " ", " ", or " ". Vertically align the image with respect to adjacent text. This defaults to " ".
 * Size : "Width " or " Height " or "Width Height " or " " or " ". Scale the image to be no greater than the given width and/or height, keeping its aspect ratio. With " ", scale a thumbnail from its default size by the given factor (default 0.75), rounding the result to the nearest multiple of 10 pixels. Size is disabled when the image is 'framed'.
 * Link : Link the image to a different resource, or to nothing. Must not be set for non-public domain images unless attribution is provided in some other fashion.
 * Alt : Specify the alt text for the image. This is intended for visually impaired readers. See WQ:ALT for how this should typically differ from the caption.
 * Caption : Specify the image's caption. Works only if "frame" or "thumb" attribute is used.

It does not matter whether the file is from Wikimedia Commons or on WikiQueer; the same syntax is used.

Detailed syntax
The image syntax begins with " ", contains components separated by " ", and ends with " ". The " " and the first " " (or, if there is no " ", the terminating " ") must be on the same line; other spaces and line breaks are ignored if they are next to " " characters or just inside the brackets. Spaces or line breaks are not allowed just before the " " in the following options, and may have undesirable side effects if they appear just after the " ".

Type
Zero or one of these options may be specified to control whether or not the image is scaled down and given a border.
 * : (Or  .) Scale the image down, and put a box around the image. Show any caption below the image. Place the image on the right unless overridden with the location attribute. If no image size is specified, use a per-user preference for logged-in users (see "Thumbnail size" under ), defaulting to 220 pixels for non-logged-in users. With an operand, e.g., " ", the operand names an image that is used as the thumbnail, ignoring any size specification.
 * : Preserve the original image size, and put a box around the image. Show any caption below the image. Sizing does not work when " " is used.
 * (nothing specified) : Preserve the original image size, and do not add a border around the image. Do not show a caption. If no alt text is specifically requested, use the requested caption as alt text.
 * : Like " ", but omit the visible caption and the box around the image. Another way to put it is that this is like specifying no type, except that the default size is that of a thumbnail and the " " option works.

Border

 * : Generate a one-pixel border around the image. This has an effect only around unframed images, as framed images always have borders.

Location
Zero or one of these options may be specified to control the position of the image.
 * : 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.
 * : Place the image on the left side of the page. The article text that follows the image flows around the image.
 * : Place the image in the center of the page. The article text that follows the image is placed below the image.
 * : Place the image on the left side of the page. The article text that follows the image is placed below the image.

Vertical alignment
Zero or one of these options may be specified to control the vertical alignment of the image with respect to adjacent text. These options apply only to plain images, which do not cause breaks and are not floated. In the following list, each option's explanation is preceded by what File:Flag of Hungary vertical.svg looks like when aligned with that option, using the markup:


 * : Flag of Hungary vertical.svg the bottom of the image with the baseline of the text.


 * middle: Flag of Hungary vertical.svg(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.


 * sub: Flag of Hungary vertical.svg 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 "X2".


 * super: Flag of Hungary vertical.svg 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 "X2".


 * text-top: Flag of Hungary vertical.svg 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 ascenders in letters like lower-case "h".


 * text-bottom: Flag of Hungary vertical.svg the bottom of the image to the bottom of the text. This is somewhat lower than the baseline, because of descenders in letters like lower-case "y".


 * top: Flag of Hungary vertical.svg 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.


 * bottom: Flag of Hungary vertical.svg 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.

Size
Zero or one 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 a 'frame' is used.
 * Width : (E.g., " ".) Scale the image to make it the specified number of pixels in width, and scale the height to retain the original aspect ratio.
 * Height : (E.g., " ".) Scale the image to make it the specified number of pixels in height, and scale the width to retain the original aspect ratio.
 * Width Height : (E.g., " ".) Scale the image to be no wider and no higher than the specified number of pixels. The image will keep its original aspect ratio.
 * (nothing specified) : For thumbnails, use the size specified in preferences for logged in users, and use a size determined by resolution for anonymous users. For non-thumbnails, use the native size of the image.
 * : Scale a thumbnail image to 75% of normal thumbnail width, rounding the result to the nearest multiple of 10 pixels.
 * Factor : Adjust a thumbnail's size to Factor times the default thumbnail size, rounding the result to the nearest multiple of 10. For instance, " " makes the image larger, which is useful for maps or schematics that need to be larger to be readable. The parameter " " returns the same size as thumbnail width, and " " is functionally identical to " " alone.

The " " option must be used along with the " " parameter.

Link
Ordinarily, an image acts as a hypertext link to the image description page, a page with information about the image itself. Using the link option allows an image to act as a hypertext link to a different page. See WikiQueer:Images linking to articles for more information. The " " parameter cannot be used in conjunction with " ", as " " is always meant to link to the larger version of the image. In addition, " " cannot be used with " ".
 * Page : The image acts as a hypertext link to the specified page. Do not enclose the page name in square brackets. If Page is a URL, the image acts as an external link; otherwise it links to the named WikiQueer page.
 * : No hyperlink is created. Clicking on the image will have no action.

One may wish to link directly to the image file without displaying any thumbnail or preview image at all, possibly useful for downloading or viewing directly with a compatible browser. The example SVG at the right contains   as such a virtual Media: link in its caption.

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 WikiQueer:Captions for discussion of appropriate caption text. See WikiQueer:Alternative text for images for discussion of appropriate alt text. Internet Explorer displays the link title as a tooltip but other browsers may not.


 * Alt : Use Alt as the alt text for the image.
 * Caption: (any text 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 (" ", " ", " " or " ") then this text appears as a caption below the image. Otherwise, (if the image type is unspecified or is " "), this text is used for the link title provided the link has not been suppressed with " ", and also for the alt text provided an explicit Alt has not been supplied.

The actual alt text for the displayed image will be one of the following, in order of preference:
 * 1) The explicitly requested Alt, if any;
 * 2) The explicitly requested Caption, if the image type has no visible caption;
 * 3) The empty string, if there is an explicitly requested Caption and the image type has a visible caption.
 * 4) The image file name if there is no explicitly requested Alt or Caption. This is never a satisfactory option.

It is only possible to specify the link title text 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.

How to display an image in uploaded size, with a caption
To display an image as uploaded with a caption use.



How to display an image with no caption or formatting
The old syntax for images without captions is. 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 readers) and as the title attribute (supplementary text, often displayed as a tool tip when the mouse is over the image).

See WikiQueer:Image markup with HTML for an old, deprecated, way of putting a caption under the image using HTML code. Please use the new way of associating captions with images, as described on this page.

See WikiQueer:Captions for discussion of appropriate caption text. See WikiQueer:Alternative text for images for discussion of appropriate alt text.

New syntax for images
The new syntax is backward compatible, so articles don't have to be changed. In the syntax  (e.g.,   shown in the left), several options can be set when including an image. Those affect the placing of the image, its size or the way the image will be presented. The options are,  ,  ,  ,  ,   ,  , and.


 * The options can be combined, and vertical bars ("|") are used to separate options from each other.
 * Do not put spaces around the vertical bars for readability – options will not be interpreted correctly.
 * The options can be put in any order.
 * An unknown option is taken as the caption text, but this will appear only if  or   are specified.
 * If there are two or more unknown options, the last one upstages the rest:  (shown on the right).

Here is the description of the options other than the caption text:

right
The image is right-aligned, and text floats to the left of the image:  (shown on the right).

left
The image is left aligned, and text floats to the right of the image:  (shown on the left).

center
The image is centered, and...the text following the image starts below it:  (shown above).

none
The image is put at the left, and...the text following does not float to the right (or to the left, obviously), and starts below it:  (shown above).


 * Notes:
 * Westminstpalace.jpg four options below (center, left, none, and right) are incompatible. When used combined, the first one overrides the rest:  (shown in the center).


 * Westminstpalace.jpg is between the last vertical bar and the closing brackets ("]]"), void or not, is taken as the last option, and works as usual. For instance, when the last option is, the image is right-aligned, and text floats to the left:   (shown on the right).


 * Westminstpalace.jpgWestminstpalace.jpg particular, if the last option is the void text (that is, if there is nothing between the last vertical bar and the closing brackets), the caption is not displayed:  (shown on the left) and   (shown on the right).


 * : Westminstpalace.jpg option renders a version of the image that's [size] pixels wide (e.g.,  shown on the right). Height is computed to keep (i.e. the shape of the image)


 * Notes:
 * 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 " ".''


 * This means the server does all the work of changing the image size, not the web browser of the user. By 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. Animated GIFs are not processed by the server. When a smaller size is specified the original full sized animated GIF is served. Whether the animated GIF is subsequently scaled to fit the allotted space is down to the capabilities of the receiving browser. Resizing an animated GIF will significantly reduce its quality, without any reduction of download time.


 * From MediaWiki 1.5 the default thumbnail width can be set in the preferences, so it is recommended not to specify "px", in order to respect the users' preferences (unless, for a special reason, a specific size is required regardless of preferences, or a size is specified outside the range of widths 120–300px that can be set in the preferences).


 * If you specify a "frame" option the image will not be scaled, and no size specifiers will be in the HTML. The image will be rendered at full size


 * Westminstpalace.jpg there are two or more "size" options, only the last one is valid:  (shown on the right).


 * ,  : Westminstpalace.jpgWestminstpalace.jpg    option generates a image. It is automatically resized when the "size" attribute is not specified. Without the options ,  , and  , the image is normally on the right. If the image has a caption text, it is displayed in the lower margin. E.g.,   (shown on the left) and   (shown on the right). Note: thumbnail (thumb) cannot be used in lists.

An "enlarge"-icon is put also in the lower margin of the thumbnail. Both the image itself and the icon link to the image description page with the image in its actual size. The icon shows the link title "Enlarge" in its hoverbox, even in cases where this term does not apply, because it leads from the enlarged image to the one with the actual size. E.g.,  (shown on the right).


 * : Westminstpalace.jpgWestminstpalace.jpg  option works in combination with the   or   option to resize an image to about 75% of the width of a plain  . The   option scales larger or smaller in step with user screen resolution. The relative size can be determined with a multiplier such as  . If x=1 then the image is standard thumbnail width. E.g.,  " option is about 75% of thumbnail width.]] (shown on the left) and  " option]] (shown on the right).


 * : Westminstpalace.jpg 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,  , and  , the image is normally on the right:.

With none of the options other than  and , an embedded image is rendered inline.

 text text text text text text text text text text text text text text text

gives

text text text text text text text text text text text text text text text

The option  can be used to have thumbnails without left- or right-alignment. This is probably most useful for tables. This is an example:

Thumbnail with caption text underneath that has one or more links
From MediaWiki 1.3, it is also possible to include links in the caption text, e.g.:







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.

Additional caption formatting options
Additional caption formatting options are possible.





All of the normal text formatting options work.

Overlaying annotations on an image
In some cases, it may be desirable to add clickable annotations to an image. The template Template:Annotated image exists for this purpose.

Compatibility considerations
The floating options left, center, and right explained above are supported by modern browsers, but don't work with older browsers. If necessary it's simple to get a floating effect also for old browsers:



This code is not intended for general use, however. There are few, if any, instances where support for such legacy browsers is necessary.

Cancelling floating-around-image mode
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, possibly due to aesthetic reasons or a change in topics.



For legacy  (etc.) floating this isn't good enough; legacy browsers would ignore inline CSS. To cancel floating under all conditions the following markup (valid XHTML 1.0 transitional) works:



The same code can be issued by using template clear or Clr or - in certain namespaces (En, meta).

Linking to the image description page
If you 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:  which yields: STS-32 crew

Images that link somewhere other than the image description page
It is possible to make an image that links to a different page instead of to the image description page by using the " " option. To disable the link altogether and have a purely decorative image, in the sense that the image is not shown to visually impaired readers, use "linkalt", with no arguments for either parameter.

Multimedia syntax
The extended syntax, in addition to yet more syntax, can also be applied to sound and video files. In these examples, File:, the namespace equivalent to Image, is used. Either namespace can be used.

Sound files (Ogg)
Normally, sound files in Ogg format are presented on WikiQueer pages using the Template:Listen or its related templates. However, it is also possible to present an audio file without any template.
 * File description icon : " ". Do not display the icon that links to the sound file description page.

Note that none of these examples provide links to WikiQueer:Media help, and examples 2 and 3 provide no navigable links to the files themselves. Thus, whenever this method is used, the Template:Inline audio 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:

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.

Sound files (MIDI)
[[Media:K520.mid]]

Video files (Ogg)
To display a video as uploaded with a caption use.



More syntax for videos
 * Initial still image : " ". 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 above:

Displaying small videos larger

To display a video larger than its uploaded size use " " and " ". 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

displays the 16-pixel 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 WikiQueer server rendering):



Thumbtime in a gallery

Until mediawiki handles the thumbtime parameter inside a gallery (as of 2010-01-24 mediawiki ignored the parameter inside &#60;gallery> tags, Gallery or Image gallery), you need to manually write a gallery if you wish to use it. The following shows how mediawiki handles thumbtime in galleries (please update this help when it changes):

Here is an example pseudo gallery that obeys thumbtime followed by the wikicode that created it.

{| style="border:solid;border-width:1px;border-color:grey"
 * }