MediaWiki  1.34.0
PackedImageGallery Class Reference
Inheritance diagram for PackedImageGallery:
Collaboration diagram for PackedImageGallery:

Public Member Functions

 __construct ( $mode='traditional', IContextSource $context=null)
 Create a new image gallery object. More...
 
 setPerRow ( $num)
 Do not support per-row on packed. More...
 
- Public Member Functions inherited from TraditionalImageGallery
 toHTML ()
 Return a HTML representation of the image gallery. More...
 
- Public Member Functions inherited from ImageGalleryBase
 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...
 
 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,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 

Public Attributes

const SCALE_FACTOR = 1.5
 We artificially have 1.5 the resolution necessary so that we can scale it up by that much on the client side, without worrying about requesting a new image. More...
 
- Public Attributes inherited from ImageGalleryBase
Parser false $mParser
 Registered parser object for output callbacks. More...
 

Protected Member Functions

 adjustImageParameters ( $thumb, &$imageParameters)
 Adjust the image parameters for a thumbnail. More...
 
 getGBPadding ()
 
 getGBWidth ( $thumb)
 
 getModules ()
 Add javascript which auto-justifies the rows by manipulating the image sizes. 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)
 
 getVPad ( $boxHeight, $thumbHeight)
 Get vertical padding for a thumbnail. More...
 
- Protected Member Functions inherited from TraditionalImageGallery
 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...
 
 getGBWidthOverwrite ( $thumb)
 Allows overwriting the computed width of the gallerybox with a string, like '100'. 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...
 
- Protected Attributes inherited from ImageGalleryBase
Title null $contextTitle = null
 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...
 
int $mHeights
 
bool $mHideBadImages
 Hide blacklisted images? More...
 
array $mImages
 Gallery images. More...
 
string $mMode
 Gallery mode. More...
 
int $mPerRow
 
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...
 
int $mWidths
 

Detailed Description

Definition at line 23 of file PackedImageGallery.php.

Constructor & Destructor Documentation

◆ __construct()

PackedImageGallery::__construct (   $mode = 'traditional',
IContextSource  $context = null 
)

Create a new image gallery object.

You should not call this directly, but instead use ImageGalleryBase::factory().

Parameters
string$mode
IContextSource | null$context

Reimplemented from ImageGalleryBase.

Definition at line 24 of file PackedImageGallery.php.

References ContextSource\$context.

Member Function Documentation

◆ adjustImageParameters()

PackedImageGallery::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 from TraditionalImageGallery.

Definition at line 89 of file PackedImageGallery.php.

References SCALE_FACTOR.

◆ getGBPadding()

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

Reimplemented from TraditionalImageGallery.

Definition at line 45 of file PackedImageGallery.php.

Referenced by getGBWidth(), and PackedOverlayImageGallery\wrapGalleryText().

◆ getGBWidth()

PackedImageGallery::getGBWidth (   $thumb)
protected
Parameters
MediaTransformOutput | bool$thumbThe thumbnail, or false if no thumb (which can happen)
Returns
float

Reimplemented from TraditionalImageGallery.

Definition at line 83 of file PackedImageGallery.php.

References getGBPadding(), getThumbDivWidth(), and SCALE_FACTOR.

Referenced by PackedOverlayImageGallery\wrapGalleryText().

◆ getModules()

PackedImageGallery::getModules ( )
protected

Add javascript which auto-justifies the rows by manipulating the image sizes.

Also ensures that the hover version of this degrades gracefully.

Returns
array

Reimplemented from TraditionalImageGallery.

Definition at line 100 of file PackedImageGallery.php.

◆ getThumbDivWidth()

PackedImageGallery::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 from TraditionalImageGallery.

Definition at line 69 of file PackedImageGallery.php.

References getThumbPadding(), and SCALE_FACTOR.

Referenced by getGBWidth().

◆ getThumbPadding()

PackedImageGallery::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 from TraditionalImageGallery.

Definition at line 41 of file PackedImageGallery.php.

Referenced by getThumbDivWidth(), getVPad(), and PackedOverlayImageGallery\wrapGalleryText().

◆ getThumbParams()

PackedImageGallery::getThumbParams (   $img)
protected
Parameters
File$imgThe file being transformed. May be false
Returns
array

Reimplemented from TraditionalImageGallery.

Definition at line 53 of file PackedImageGallery.php.

References ImageGalleryBase\$mWidths, MEDIATYPE_AUDIO, and SCALE_FACTOR.

◆ getVPad()

PackedImageGallery::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 from TraditionalImageGallery.

Definition at line 37 of file PackedImageGallery.php.

References getThumbPadding().

◆ setPerRow()

PackedImageGallery::setPerRow (   $num)

Do not support per-row on packed.

It really doesn't work since the images have varying widths.

Parameters
int$num

Reimplemented from ImageGalleryBase.

Definition at line 109 of file PackedImageGallery.php.

Member Data Documentation

◆ SCALE_FACTOR

const PackedImageGallery::SCALE_FACTOR = 1.5

We artificially have 1.5 the resolution necessary so that we can scale it up by that much on the client side, without worrying about requesting a new image.

Definition at line 35 of file PackedImageGallery.php.

Referenced by adjustImageParameters(), getGBWidth(), getThumbDivWidth(), and getThumbParams().


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