Actions

Template

Difference between revisions of "H2w"

From NEC Retro

(Created page with "<includeonly>{{#expr: ({{#mediawidth:{{{1}}}}}*({{{2}}} div {{#mediaheight:{{{1}}}}})) round 0 }}</includeonly><noinclude> This template obtains the width of a resized image,...")
 
m (Text replacement - "Category:NEC Retro templates" to "Category:Templates")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#expr: ({{#mediawidth:{{{1}}}}}*({{{2}}} div {{#mediaheight:{{{1}}}}})) round 0 }}</includeonly><noinclude>
+
<includeonly>{{#expr: floor({{#mediawidth:{{{1}}}}}*({{{2}}} div {{#mediaheight:{{{1}}}}})) }}</includeonly><noinclude>
 
This template obtains the width of a resized image, given that its height is known.
 
This template obtains the width of a resized image, given that its height is known.
  
 
==Example==
 
==Example==
<tt><nowiki>{{h2w|GoldenAxe Title.png|224}}</nowiki></tt> returns '''{{h2w|GoldenAxe Title.png|224}}'''
+
<tt><nowiki>{{h2w|Sonic1 title.png|224}}</nowiki></tt> returns '''{{h2w|Sonic1 title.png|224}}'''
  
<tt><nowiki>{{h2w|GoldenAxe Title.png|112}}</nowiki></tt> returns '''{{h2w|GoldenAxe Title.png|112}}'''
+
<tt><nowiki>{{h2w|Sonic1 title.png|112}}</nowiki></tt> returns '''{{h2w|Sonic1 title.png|112}}'''
  
<tt><nowiki>{{h2w|GoldenAxe Title.png|97}}</nowiki></tt> returns '''{{h2w|GoldenAxe Title.png|97}}'''
+
<tt><nowiki>{{h2w|Sonic1 title.png|97}}</nowiki></tt> returns '''{{h2w|Sonic1 title.png|97}}'''
  
[[Category:NEC Retro templates|{{PAGENAME}}]]</noinclude>
+
[[Category:Templates]]</noinclude>

Latest revision as of 14:55, 1 January 2022

This template obtains the width of a resized image, given that its height is known.

Example

{{h2w|Sonic1 title.png|224}} returns 320

{{h2w|Sonic1 title.png|112}} returns 160

{{h2w|Sonic1 title.png|97}} returns 138