MediaWiki  1.33.0
TraditionalImageGallery Class Reference
Inheritance diagram for TraditionalImageGallery:
Collaboration diagram for TraditionalImageGallery:

Public Member Functions

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

Protected Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 23 of file TraditionalImageGallery.php.

Member Function Documentation

◆ adjustImageParameters()

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 PackedImageGallery.

Definition at line 390 of file TraditionalImageGallery.php.

Referenced by toHTML().

◆ getAllPadding()

TraditionalImageGallery::getAllPadding ( )
protected

Get total padding.

Returns
int Number of pixels of whitespace surrounding the thumbnail.

Definition at line 302 of file TraditionalImageGallery.php.

References getGBBorders(), getGBPadding(), and getThumbPadding().

Referenced by toHTML().

◆ getCaptionHtml()

TraditionalImageGallery::getCaptionHtml ( Title  $nt,
Language  $lang 
)
protected
Parameters
Title$nt
Language$lang
Returns
string HTML

Definition at line 221 of file TraditionalImageGallery.php.

References getCaptionLength(), Title\getText(), Linker\linkKnown(), and Language\truncateForVisual().

Referenced by toHTML().

◆ getCaptionLength()

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 293 of file TraditionalImageGallery.php.

References ImageGalleryBase\$mCaptionLength.

Referenced by getCaptionHtml().

◆ getGBBorders()

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 NolinesImageGallery.

Definition at line 282 of file TraditionalImageGallery.php.

Referenced by getAllPadding().

◆ getGBPadding()

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

Reimplemented in PackedImageGallery.

Definition at line 271 of file TraditionalImageGallery.php.

Referenced by getAllPadding(), and getGBWidth().

◆ getGBWidth()

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 | bool$thumbMediaTransformObject object or false.
Returns
int Width of gallerybox element

Reimplemented in PackedImageGallery.

Definition at line 353 of file TraditionalImageGallery.php.

References getGBPadding(), and getThumbPadding().

Referenced by toHTML().

◆ getGBWidthOverwrite()

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 | bool$thumbMediaTransformObject object or false.
Returns
bool|string Ignored if false.

Definition at line 368 of file TraditionalImageGallery.php.

Referenced by toHTML().

◆ getModules()

TraditionalImageGallery::getModules ( )
protected

Get a list of modules to include in the page.

Primarily intended for subclasses.

Returns
array Modules to include

Reimplemented in PackedImageGallery, and SlideshowImageGallery.

Definition at line 379 of file TraditionalImageGallery.php.

Referenced by toHTML().

◆ getThumbDivWidth()

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
int Width of inner thumb div.

Reimplemented in PackedImageGallery.

Definition at line 339 of file TraditionalImageGallery.php.

References getThumbPadding().

Referenced by toHTML().

◆ getThumbPadding()

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 PackedImageGallery, and NolinesImageGallery.

Definition at line 262 of file TraditionalImageGallery.php.

Referenced by getAllPadding(), getGBWidth(), getThumbDivWidth(), getVPad(), and toHTML().

◆ getThumbParams()

TraditionalImageGallery::getThumbParams (   $img)
protected

Get the transform parameters for a thumbnail.

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

Reimplemented in PackedImageGallery.

Definition at line 325 of file TraditionalImageGallery.php.

Referenced by toHTML().

◆ getVPad()

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
int Vertical padding to add on each side.

Reimplemented in PackedImageGallery, and NolinesImageGallery.

Definition at line 315 of file TraditionalImageGallery.php.

References getThumbPadding().

Referenced by toHTML().

◆ toHTML()

TraditionalImageGallery::toHTML ( )

◆ wrapGalleryText()

TraditionalImageGallery::wrapGalleryText (   $galleryText,
  $thumb 
)
protected

Add the wrapper html around the thumb's caption.

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

Reimplemented in PackedOverlayImageGallery.

Definition at line 245 of file TraditionalImageGallery.php.

Referenced by toHTML().


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