MediaWiki  1.23.8
PackedImageGallery.php
Go to the documentation of this file.
1 <?php
24  function __construct( $mode = 'traditional' ) {
25  parent::__construct( $mode );
26  // Does not support per row option.
27  $this->mPerRow = 0;
28  }
29 
35  const SCALE_FACTOR = 1.5;
36 
37  protected function getVPad( $boxHeight, $thumbHeight ) {
38  return ( $this->getThumbPadding() + $boxHeight - $thumbHeight / self::SCALE_FACTOR ) / 2;
39  }
40 
41  protected function getThumbPadding() {
42  return 0;
43  }
44 
45  protected function getGBPadding() {
46  return 2;
47  }
48 
53  protected function getThumbParams( $img ) {
54  if ( $img && $img->getMediaType() === MEDIATYPE_AUDIO ) {
55  $width = $this->mWidths;
56  } else {
57  // We want the width not to be the constraining
58  // factor, so use random big number.
59  $width = $this->mHeights * 10 + 100;
60  }
61 
62  // self::SCALE_FACTOR so the js has some room to manipulate sizes.
63  return array(
64  'width' => $width * self::SCALE_FACTOR,
65  'height' => $this->mHeights * self::SCALE_FACTOR,
66  );
67  }
68 
69  protected function getThumbDivWidth( $thumbWidth ) {
70  // Require at least 60px wide, so caption is wide enough to work.
71  if ( $thumbWidth < 60 * self::SCALE_FACTOR ) {
72  $thumbWidth = 60 * self::SCALE_FACTOR;
73  }
74 
75  return $thumbWidth / self::SCALE_FACTOR + $this->getThumbPadding();
76  }
77 
83  protected function getGBWidth( $thumb ) {
84  $thumbWidth = $thumb ? $thumb->getWidth() : $this->mWidths * self::SCALE_FACTOR;
85 
86  return $this->getThumbDivWidth( $thumbWidth ) + $this->getGBPadding();
87  }
88 
89  protected function adjustImageParameters( $thumb, &$imageParameters ) {
90  // Re-adjust back to normal size.
91  $imageParameters['override-width'] = ceil( $thumb->getWidth() / self::SCALE_FACTOR );
92  $imageParameters['override-height'] = ceil( $thumb->getHeight() / self::SCALE_FACTOR );
93  }
94 
99  protected function getModules() {
100  return array( 'mediawiki.page.gallery' );
101  }
102 
107  public function setPerRow( $num ) {
108  return;
109  }
110 }
PackedImageGallery\getThumbDivWidth
getThumbDivWidth( $thumbWidth)
Get the width of the inner div that contains the thumbnail in question.
Definition: PackedImageGallery.php:69
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
PackedImageGallery\getModules
getModules()
Add javascript which auto-justifies the rows by manipulating the image sizes.
Definition: PackedImageGallery.php:99
PackedImageGallery\getThumbPadding
getThumbPadding()
How much padding such the thumb have between image and inner div that that contains the border.
Definition: PackedImageGallery.php:41
PackedImageGallery\getGBPadding
getGBPadding()
Definition: PackedImageGallery.php:45
PackedImageGallery\getVPad
getVPad( $boxHeight, $thumbHeight)
Get vertical padding for a thumbnail.
Definition: PackedImageGallery.php:37
TraditionalImageGallery
Definition: TraditionalImageGallery.php:23
PackedImageGallery\getGBWidth
getGBWidth( $thumb)
Definition: PackedImageGallery.php:83
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
PackedImageGallery\__construct
__construct( $mode='traditional')
Create a new image gallery object.
Definition: PackedImageGallery.php:24
PackedImageGallery\setPerRow
setPerRow( $num)
Do not support per-row on packed.
Definition: PackedImageGallery.php:107
PackedImageGallery\getThumbParams
getThumbParams( $img)
Definition: PackedImageGallery.php:53
PackedImageGallery\adjustImageParameters
adjustImageParameters( $thumb, &$imageParameters)
Adjust the image parameters for a thumbnail.
Definition: PackedImageGallery.php:89
PackedImageGallery
Definition: PackedImageGallery.php:23
PackedImageGallery\SCALE_FACTOR
const SCALE_FACTOR
We artificially have 1.5 the resolution neccessary so that we can scale it up by that much on the cli...
Definition: PackedImageGallery.php:35
MEDIATYPE_AUDIO
const MEDIATYPE_AUDIO
Definition: Defines.php:129