Module:File link/doc: Difference between revisions

Content deleted Content added
add three methods
add size-related methods
Line 68:
 
Sets the display format. <var>s</var> must either be nil, or one of the strings 'thumb', 'thumbnail', 'frame', 'framed', or 'frameless'. To see the effect of each of these options, see the [[mw:Help:Images#Format|images help page on mediawiki.org]]. Note that the ''border'' format is not set with this method, but with the [[#Border|border method]]. (This is because the border option can be set independently of the values that can be set with this method, for example in the code <code><nowiki>[[File:Example.png|frameless|border|caption]]</nowiki></code>.)
 
The <var>filename</var> variable is an optional variable that can be used to set the filename for thumbnails. The filename specified will be used instead of the automatically generated thumbnail. This option doesn't have any effect on the other format options.
 
=== Border ===
Line 75 ⟶ 77:
</source>
 
Sets a border for the imageimages. <var>hasBorder</var> must either be nil, or a boolean value. A border will be set if <var>hasBorder</var> is true. To see the effect of this option, see the [[mw:Help:Images#Format|images help page on mediawiki.org]].
 
=== Width ===
 
<source lang="lua">
obj:width(px)
</source>
 
Sets a width for the file in pixels. <var>px</var> must either be nil or a number value. Width can be used in conjunction with the [[#Height|height method]], but will produce an error if used when the ''upright'' option has been set by the [[#Upright|upright method]].
 
=== Height ===
 
<source lang="lua">
obj:height(px)
</source>
 
Sets a height for the file in pixels. <var>px</var> must either be nil or a number value. Height can be used in conjunction with the [[#Width|width method]], but will produce an error if used when the ''upright'' option has been set by the [[#Upright|upright method]].
 
=== Upright ===
 
<source lang="lua">
obj:upright(isUpright, factor)
</source>
 
Sets the ''upright'' option, used for images that are taller than they are wide. <var>isUpright</var> must either be nil, or a boolean value. The upright option will be set if <var>isUpright</var> is true. <var>factor</var> provides an optional conversion factor for the upright option; the factor is the image's width divided by its height. If no factor is specified, the MediaWiki software uses the default of 0.75. <var>factor</var> must be either nil or a number value. If a width or height has been set with the [[#Width|width]] or [[#Height|height]] methods, then setting the upright value will result in an error.
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||