This makes the PHP parser behavior consistent with the specification at
https://www.mediawiki.org/wiki/Help:Images#Size_and_frame which says:
"An image with frame always ignores the size specification."
This is actually a fix to File::getUnscaledThumb() -- which didn't
actually return an unscaled thumb if the 'height' parameter was set.
Bug: 62258
Change-Id: I0ce295a4681042c446314945da5f811448b44fe6
return $this->iconThumb();
}
$hp['width'] = $width;
return $this->iconThumb();
}
$hp['width'] = $width;
+ // be sure to ignore any height specification as well (bug 62258)
+ unset( $hp['height'] );
return $this->transform( $hp );
}
return $this->transform( $hp );
}
# Foobar has actual size of 1941x220
# 1. Thumbs & frameless always reduce, can't be enlarged unless it's
# a scalable format.
# Foobar has actual size of 1941x220
# 1. Thumbs & frameless always reduce, can't be enlarged unless it's
# a scalable format.
-# 2. Framed images ignore width; always render at default size.
-# If given a height, they respect height but continue to ignore width.
+# 2. Framed images always ignore size options; always render at default size.
# 3. "Unspecified format" and border are the only types which can be
# enlarged.
# 3. "Unspecified format" and border are the only types which can be
# enlarged.
-Image: framed images ignore size if only width is given
+Image: framed images are always unscaled.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frame|50px]]
[[File:Foobar.jpg|frame|50px]]
+[[File:Foobar.jpg|frame|50x50px]]
+
[[File:Foobar.jpg|frame|2000px]]
!! html/php
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
[[File:Foobar.jpg|frame|2000px]]
!! html/php
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
-<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
-!! end
-
-!! test
-Image: framed images respect size if given a height, but ignore width.
-!! wikitext
-[[File:Foobar.jpg|frame|50x50px]]
-!! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:444px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" width="442" height="50" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
-
-!! html/parsoid
-<figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="50" width="442"/></a></figure>
+<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
!! end
###################
!! end
###################