MediaWiki master
MediaWiki\Gallery\TraditionalImageGallery Class Reference

Image gallery. More...

Inherits MediaWiki\Gallery\ImageGalleryBase.

Inherited by MediaWiki\Gallery\NolinesImageGallery, MediaWiki\Gallery\PackedImageGallery, and MediaWiki\Gallery\SlideshowImageGallery.

Collaboration diagram for MediaWiki\Gallery\TraditionalImageGallery:

Public Member Functions

 toHTML ()
 Return a HTML representation of the image gallery.
 
- Public Member Functions inherited from MediaWiki\Gallery\ImageGalleryBase
 __construct ( $mode='traditional', ?IContextSource $context=null)
 Create a new image gallery object.
 
 add ( $title, $html='', $alt='', $link='', $handlerOpts=[], $loading=self::LOADING_DEFAULT, ?array $imageOptions=null)
 Add an image to the gallery.
 
 count ()
 
 getContextTitle ()
 Get the contextual title, if applicable.
 
 getImages ()
 Returns the list of images this gallery contains.
 
 insert ( $title, $html='', $alt='', $link='', $handlerOpts=[], $loading=self::LOADING_DEFAULT, ?array $imageOptions=null)
 Add an image at the beginning of the gallery.
 
 isEmpty ()
 isEmpty() returns true if the gallery contains no images
 
 setAdditionalOptions ( $options)
 Allow setting additional options.
 
 setAttributes ( $attribs)
 Set arbitrary attributes to go on the HTML gallery output element.
 
 setCaption ( $caption)
 Set the caption (as plain text)
 
 setCaptionHtml ( $caption)
 Set the caption (as HTML)
 
 setContextTitle ( $title)
 Set the contextual title.
 
 setHeights ( $num)
 Set how high each image will be, in pixels.
 
 setHideBadImages ( $flag=true)
 
 setParser ( $parser)
 Register a parser object.
 
 setPerRow ( $num)
 Set how many images will be displayed per row.
 
 setShowBytes ( $f)
 Enable/Disable showing of the file size of an image in the gallery.
 
 setShowDimensions ( $f)
 Enable/Disable showing of the dimensions of an image in the gallery.
 
 setShowFilename ( $f)
 Enable/Disable showing of the filename of an image in the gallery.
 
 setWidths ( $num)
 Set how wide each image will be, in pixels.
 
- Public Member Functions inherited from MediaWiki\Context\ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getActionName ()
 Get the action name for the current web request.
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getLanguageCode ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Protected Member Functions

 adjustImageParameters ( $thumb, &$imageParameters)
 Adjust the image parameters for a thumbnail.
 
 getAllPadding ()
 Get total padding.
 
 getCaptionHtml (Title $nt, Language $lang, LinkRenderer $linkRenderer)
 
 getCaptionLength ()
 Length (in characters) to truncate filename to in caption when using "showfilename" (if int).
 
 getGBBorders ()
 Get how much extra space the borders around the image takes up.
 
 getGBPadding ()
 
 getGBWidth ( $thumb)
 Computed width of gallerybox .
 
 getGBWidthOverwrite ( $thumb)
 Allows overwriting the computed width of the gallerybox with a string, like '100'.
 
 getModules ()
 Get a list of modules to include in the page.
 
 getThumbDivWidth ( $thumbWidth)
 Get the width of the inner div that contains the thumbnail in question.
 
 getThumbPadding ()
 How much padding the thumb has between the image and the inner div that contains the border.
 
 getThumbParams ( $img)
 Get the transform parameters for a thumbnail.
 
 getVPad ( $boxHeight, $thumbHeight)
 Get vertical padding for a thumbnail.
 
 wrapGalleryText ( $galleryText, $thumb)
 Add the wrapper html around the thumb's caption.
 
- Protected Member Functions inherited from MediaWiki\Gallery\ImageGalleryBase
 getRenderLang ()
 Determines the correct language to be used for this image gallery.
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\Gallery\ImageGalleryBase
static factory ( $mode=false, ?IContextSource $context=null)
 Get a new image gallery.
 
- Public Attributes inherited from MediaWiki\Gallery\ImageGalleryBase
Parser false $mParser
 Registered parser object for output callbacks.
 
const LOADING_DEFAULT = 1
 
const LOADING_LAZY = 2
 
- Protected Attributes inherited from MediaWiki\Gallery\ImageGalleryBase
Title null $contextTitle = null
 Contextual title, used when images are being screened against the bad image list.
 
array $mAttribs = []
 
string false $mCaption = false
 Gallery caption.
 
bool int $mCaptionLength = true
 Length to truncate filename to in caption when using "showfilename".
 
int $mHeights
 
bool $mHideBadImages
 Hide bad images?
 
array[] $mImages
 Gallery images.
 
string $mMode
 Gallery mode.
 
int $mPerRow
 
bool $mShowBytes
 Whether to show the filesize in bytes in categories.
 
bool $mShowDimensions
 Whether to show the dimensions in categories.
 
bool $mShowFilename
 Whether to show the filename.
 
int $mWidths
 

Detailed Description

Image gallery.

Definition at line 27 of file TraditionalImageGallery.php.

Member Function Documentation

◆ adjustImageParameters()

MediaWiki\Gallery\TraditionalImageGallery::adjustImageParameters ( $thumb,
& $imageParameters )
protected

Adjust the image parameters for a thumbnail.

Used by a subclass to insert extra high resolution images.

Parameters
MediaTransformOutput$thumbThe thumbnail
array&$imageParametersArray of options

Reimplemented in MediaWiki\Gallery\PackedImageGallery.

Definition at line 414 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getAllPadding()

MediaWiki\Gallery\TraditionalImageGallery::getAllPadding ( )
protected

◆ getCaptionHtml()

MediaWiki\Gallery\TraditionalImageGallery::getCaptionHtml ( Title $nt,
Language $lang,
LinkRenderer $linkRenderer )
protected

◆ getCaptionLength()

MediaWiki\Gallery\TraditionalImageGallery::getCaptionLength ( )
protected

Length (in characters) 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.

Returns
int|bool

Definition at line 317 of file TraditionalImageGallery.php.

References MediaWiki\Gallery\ImageGalleryBase\$mCaptionLength.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\getCaptionHtml().

◆ getGBBorders()

MediaWiki\Gallery\TraditionalImageGallery::getGBBorders ( )
protected

Get how much extra space the borders around the image takes up.

For this mode, it is 2px borders on each side + 2px implied padding on each side from the stylesheet, giving us 2*2+2*2 = 8.

Returns
int

Reimplemented in MediaWiki\Gallery\NolinesImageGallery.

Definition at line 306 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\getAllPadding().

◆ getGBPadding()

MediaWiki\Gallery\TraditionalImageGallery::getGBPadding ( )
protected
Note
GB stands for gallerybox (as in the element)
Returns
int

Reimplemented in MediaWiki\Gallery\PackedImageGallery.

Definition at line 295 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\getAllPadding(), and MediaWiki\Gallery\TraditionalImageGallery\getGBWidth().

◆ getGBWidth()

MediaWiki\Gallery\TraditionalImageGallery::getGBWidth ( $thumb)
protected

Computed width of gallerybox .

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.
Parameters
MediaTransformOutput | false$thumb
Returns
float Width of gallerybox element

Reimplemented in MediaWiki\Gallery\PackedImageGallery.

Definition at line 377 of file TraditionalImageGallery.php.

References MediaWiki\Gallery\TraditionalImageGallery\getGBPadding(), and MediaWiki\Gallery\TraditionalImageGallery\getThumbPadding().

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getGBWidthOverwrite()

MediaWiki\Gallery\TraditionalImageGallery::getGBWidthOverwrite ( $thumb)
protected

Allows overwriting the computed width of the gallerybox 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.
Parameters
MediaTransformOutput | false$thumb
Returns
string|false Ignored if false.

Definition at line 392 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getModules()

MediaWiki\Gallery\TraditionalImageGallery::getModules ( )
protected

Get a list of modules to include in the page.

Primarily intended for subclasses.

Returns
array Modules to include

Reimplemented in MediaWiki\Gallery\PackedImageGallery, and MediaWiki\Gallery\SlideshowImageGallery.

Definition at line 403 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getThumbDivWidth()

MediaWiki\Gallery\TraditionalImageGallery::getThumbDivWidth ( $thumbWidth)
protected

Get the width of the inner div that contains the thumbnail in question.

This is the div with the class of "thumb".

Parameters
int$thumbWidthThe width of the thumbnail.
Returns
float Width of inner thumb div.

Reimplemented in MediaWiki\Gallery\PackedImageGallery.

Definition at line 363 of file TraditionalImageGallery.php.

References MediaWiki\Gallery\TraditionalImageGallery\getThumbPadding().

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getThumbPadding()

MediaWiki\Gallery\TraditionalImageGallery::getThumbPadding ( )
protected

How much padding the thumb has between the image and the inner div that contains the border.

This is for both vertical and horizontal padding. (However, it is cut in half in the vertical direction).

Returns
int

Reimplemented in MediaWiki\Gallery\NolinesImageGallery, and MediaWiki\Gallery\PackedImageGallery.

Definition at line 286 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\getAllPadding(), MediaWiki\Gallery\TraditionalImageGallery\getGBWidth(), MediaWiki\Gallery\TraditionalImageGallery\getThumbDivWidth(), MediaWiki\Gallery\TraditionalImageGallery\getVPad(), and MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getThumbParams()

MediaWiki\Gallery\TraditionalImageGallery::getThumbParams ( $img)
protected

Get the transform parameters for a thumbnail.

Parameters
File | false$imgThe file in question. May be false for invalid image
Returns
array

Reimplemented in MediaWiki\Gallery\PackedImageGallery.

Definition at line 349 of file TraditionalImageGallery.php.

References MediaWiki\Gallery\ImageGalleryBase\$mHeights, and MediaWiki\Gallery\ImageGalleryBase\$mWidths.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ getVPad()

MediaWiki\Gallery\TraditionalImageGallery::getVPad ( $boxHeight,
$thumbHeight )
protected

Get vertical padding for a thumbnail.

Generally this is the total height minus how high the thumb is.

Parameters
int$boxHeightHow high we want the box to be.
int$thumbHeightHow high the thumbnail is.
Returns
float Vertical padding to add on each side.

Reimplemented in MediaWiki\Gallery\NolinesImageGallery, and MediaWiki\Gallery\PackedImageGallery.

Definition at line 339 of file TraditionalImageGallery.php.

References MediaWiki\Gallery\TraditionalImageGallery\getThumbPadding().

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().

◆ toHTML()

◆ wrapGalleryText()

MediaWiki\Gallery\TraditionalImageGallery::wrapGalleryText ( $galleryText,
$thumb )
protected

Add the wrapper html around the thumb's caption.

Parameters
string$galleryTextThe caption
MediaTransformOutput | false$thumbThe thumb this caption is for or false for bad image.
Returns
string

Reimplemented in MediaWiki\Gallery\PackedOverlayImageGallery.

Definition at line 276 of file TraditionalImageGallery.php.

Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().


The documentation for this class was generated from the following file: