Getdim
From NEC Retro
Revision as of 09:06, 28 December 2021 by Black Squirrel (talk | contribs) (Created page with "<includeonly>{{#vardefine:actuald|{{#replace:{{#if:{{{file|}}}|{{#mediadimensions:{{{file|}}}}}|{{{actual|}}}}}|×|x}}}}{{#vardefine:actualw|{{#explode:{{#var:actuald}}|x|0}}}...")
Revision as of 09:06, 28 December 2021 by Black Squirrel (talk | contribs) (Created page with "<includeonly>{{#vardefine:actuald|{{#replace:{{#if:{{{file|}}}|{{#mediadimensions:{{{file|}}}}}|{{{actual|}}}}}|×|x}}}}{{#vardefine:actualw|{{#explode:{{#var:actuald}}|x|0}}}...")
This template obtains the width or height of a resized image, given the real dimensions of that image.
Usage
{{getdim|actual=320x224|w=160|output=h}}
returns: 112
{{getdim|actual=320x224|h=112|output=w}}
returns: 160
{{getdim|actual=320x224|h=112|w=1000|output=w}}
returns: 160
{{getdim|actual={{#mediadimensions:Sonic1 title.png}}|w=160|h=1000|output=w|var=sanic}}{{#var:sanic}}
returns: 160
{{getdim|file=Sonic1 title.png|w=1000|h=112|output=w}}
returns: 160