Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Imagesize/doc
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!
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> This module is adapted from the 'getdimensions' function in [[Module:Multiple image]] for use as a stand-alone. It has four public functions: getWidth, getHeight, getDimensions, getScale. They take a filename, with or without the "File:" prefix, and return the width, the height, both dimensions (WIDTHxHEIGHT), or the ratio of width to height (multiplied by a scale factor) respectively. It works with files on Commons or local ones, and works with animated gifs using the dimensions of the first image. The getScale function takes an additional parameter, {{para|scale}} (default is 1). This can be used to directly scale images to the same height using the {{para|upright}} parameter in image syntax. == Examples == * <code><nowiki>{{#invoke:Sandbox/Imagesize|getDimensions|Example.jpg}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getDimensions|Example.jpg}} * <code><nowiki>{{#invoke:Sandbox/Imagesize|getWidth|Example.jpg}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getWidth|Example.jpg}} * <code><nowiki>{{#invoke:Sandbox/Imagesize|getHeight|Example.jpg}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getHeight|Example.jpg}} * <code><nowiki>{{#invoke:Sandbox/Imagesize|getScale|Example.jpg|scale=1}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getScale|Example.jpg|scale=1}} * <code><nowiki>{{#invoke:Sandbox/Imagesize|getDimensions|File:Bishzilla Lucia Looking Right.gif}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getDimensions|File:Bishzilla Lucia Looking Right.gif}} * <code><nowiki>{{#invoke:Sandbox/Imagesize|getDimensions|File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getDimensions|File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg}} * <code><nowiki>{{#invoke:Sandbox/Imagesize|getScale|File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg|scale=1}}</nowiki></code> β {{#invoke:Sandbox/Imagesize|getScale|File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg|scale=1}} {| class="wikitable" |- ! colspan="2" | Same height, scale=1 |- | [[File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg|thumb|upright={{#invoke:Sandbox/Imagesize|getScale|File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg|scale=1}}]] | [[File:Example.jpg|thumb|upright={{#invoke:Sandbox/Imagesize|getScale|Example.jpg|scale=1}}]] |- ! colspan="2" | Same height, scale=0.5 |- | [[File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg|thumb|upright={{#invoke:Sandbox/Imagesize|getScale|File:Doorway from Moutiers-Saint-Jean MET DP255158.jpg|scale=0.5}}]] | [[File:Example.jpg|thumb|upright={{#invoke:Sandbox/Imagesize|getScale|Example.jpg|scale=0.5}}]] |} <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly>
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Para
(
edit
)
Module:Sandbox/Imagesize
(
edit
)