'imagesPerRow' => 0, // Default number of images per-row in the gallery. 0 -> Adapt to screensize
'imageWidth' => 120, // Width of the cells containing images in galleries (in "px")
'imageHeight' => 120, // Height of the cells containing images in galleries (in "px")
- 'captionLength' => 25, // Length to truncate filename to in caption when using "showfilename"
+ 'captionLength' => true, // Deprecated @since 1.28
+ // Length to truncate filename to in caption when using "showfilename".
+ // A value of 'true' will truncate the filename to one line using CSS
+ // and will be the behaviour after deprecation.
'showBytes' => true, // Show the filesize in bytes in categories
'mode' => 'traditional',
];
// Preloaded into LinkCache above
Linker::linkKnown(
$nt,
- htmlspecialchars( $lang->truncate( $nt->getText(), $this->mCaptionLength ) )
- ) . "<br />\n" :
+ htmlspecialchars(
+ $this->mCaptionLength !== true ?
+ $lang->truncate( $nt->getText(), $this->mCaptionLength ) :
+ $nt->getText()
+ ),
+ [
+ 'class' => 'galleryfilename' .
+ ( $this->mCaptionLength === true ? ' galleryfilename-truncate' : '' )
+ ]
+ ) . "\n" :
'';
$galleryText = $textlink . $text . $fileSize;
<li class="gallerybox" style="width: 155px"><div style="width: 155px">
<div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
<div class="gallerytext">
-<p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
+<p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
caption
</p>
</div>
<li class="gallerybox" style="width: 155px"><div style="width: 155px">
<div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
<div class="gallerytext">
-<p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
+<p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
</p>
</div>
</div></li>
<li class="gallerybox" style="width: 155px"><div style="width: 155px">
<div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
<div class="gallerytext">
-<p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
+<p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
</p>
</div>
<li class="gallerybox" style="width: 155px"><div style="width: 155px">
<div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
<div class="gallerytext">
-<p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
+<p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
</p>
</div>
</div></li>