// ":{$ut}" );
// $ul = Linker::link( $linkTarget, $ut );
- if ( $this->mShowBytes ) {
- if ( $img ) {
- $fileSize = htmlspecialchars( $lang->formatSize( $img->getSize() ) );
- } else {
- $fileSize = $this->msg( 'filemissing' )->escaped();
+ $meta = [];
+ if ( $img ) {
+ if ( $this->mShowDimensions ) {
+ $meta[] = $img->getDimensionsString();
}
- $fileSize = "$fileSize<br />\n";
- } else {
- $fileSize = '';
+ if ( $this->mShowBytes ) {
+ $meta[] = htmlspecialchars( $lang->formatSize( $img->getSize() ) );
+ }
+ } elseif ( $this->mShowDimensions || $this->mShowBytes ) {
+ $meta[] = $this->msg( 'filemissing' )->escaped();
+ }
+ $meta = $lang->semicolonList( $meta );
+ if ( $meta ) {
+ $meta .= "<br />\n";
}
$textlink = $this->mShowFilename ?
Linker::linkKnown(
$nt,
htmlspecialchars(
- $this->mCaptionLength !== true ?
- $lang->truncate( $nt->getText(), $this->mCaptionLength ) :
+ is_int( $this->getCaptionLength() ) ?
+ $lang->truncate( $nt->getText(), $this->getCaptionLength() ) :
$nt->getText()
),
[
'class' => 'galleryfilename' .
- ( $this->mCaptionLength === true ? ' galleryfilename-truncate' : '' )
+ ( $this->getCaptionLength() === true ? ' galleryfilename-truncate' : '' )
]
) . "\n" :
'';
- $galleryText = $textlink . $text . $fileSize;
+ $galleryText = $textlink . $text . $meta;
$galleryText = $this->wrapGalleryText( $galleryText, $thumb );
+ $gbWidth = $this->getGBWidth( $thumb ) . 'px';
+ if ( $this->getGBWidthOverwrite( $thumb ) ) {
+ $gbWidth = $this->getGBWidthOverwrite( $thumb );
+ }
# Weird double wrapping (the extra div inside the li) needed due to FF2 bug
# Can be safely removed if FF2 falls completely out of existence
$output .= "\n\t\t" . '<li class="gallerybox" style="width: '
- . $this->getGBWidth( $thumb ) . 'px">'
- . '<div style="width: ' . $this->getGBWidth( $thumb ) . 'px">'
+ . $gbWidth . '">'
+ . '<div style="width: ' . $gbWidth . '">'
. $thumbhtml
. $galleryText
. "\n\t\t</div></li>";
return 8;
}
+ /**
+ * Length to truncate filename to in caption when using "showfilename" (if int).
+ * A value of 'true' will truncate the filename to one line using CSS, while
+ * 'false' will disable truncating.
+ *
+ * @return int|bool
+ */
+ protected function getCaptionLength() {
+ return $this->mCaptionLength;
+ }
+
/**
* Get total padding.
*
}
/**
- * Width of gallerybox <li>.
+ * Computed width of gallerybox <li>.
*
* Generally is the width of the image, plus padding on image
* plus padding on gallerybox.
return $this->mWidths + $this->getThumbPadding() + $this->getGBPadding();
}
+ /**
+ * Allows overwriting the computed width of the gallerybox <li> with a string,
+ * like '100%'.
+ *
+ * Generally is the width of the image, plus padding on image
+ * plus padding on gallerybox.
+ *
+ * @note Important: parameter will be false if no thumb used.
+ * @param MediaTransformOutput|bool $thumb MediaTransformObject object or false.
+ * @return bool|string Ignored if false.
+ */
+ protected function getGBWidthOverwrite( $thumb ) {
+ return false;
+ }
+
/**
* Get a list of modules to include in the page.
*
*
* Used by a subclass to insert extra high resolution images.
* @param MediaTransformOutput $thumb The thumbnail
- * @param array $imageParameters Array of options
+ * @param array &$imageParameters Array of options
*/
protected function adjustImageParameters( $thumb, &$imageParameters ) {
}
}
-
-/**
- * Backwards compatibility. This always uses traditional mode
- * if called the old way, for extensions that may expect traditional
- * mode.
- *
- * @deprecated since 1.22 Use ImageGalleryBase::factory instead.
- */
-class ImageGallery extends TraditionalImageGallery {
- function __construct( $mode = 'traditional' ) {
- wfDeprecated( __METHOD__, '1.22' );
- parent::__construct( $mode );
- }
-}