From: Raimond Spekking Date: Wed, 3 Mar 2010 13:07:23 +0000 (+0000) Subject: (bug 12797) Allow adjusting of default gallery display options X-Git-Tag: 1.31.0-rc.0~37565 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/supprimer.php?a=commitdiff_plain;h=260cc188fa13f4ce81f47f585e64121739b2cad3;p=lhc%2Fweb%2Fwiklou.git (bug 12797) Allow adjusting of default gallery display options --- diff --git a/CREDITS b/CREDITS index 05fe9ea102..76bc980d7f 100644 --- a/CREDITS +++ b/CREDITS @@ -117,6 +117,7 @@ following names for their contribution to the product. * Stefano Codari * Str4nd * svip +* Zachary Hauri == Translators == * Anders Wegge Jakobsen diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 920e879bd2..1aca2ac4a2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -19,7 +19,12 @@ Those wishing to use the latest code instead of a branch release can obtain it from source control: http://www.mediawiki.org/wiki/Download_from_SVN === Configuration changes in 1.17 === - +* (bug 12797) Allow adjusting of default gallery display options: + $wgGalleryImagesPerRow, $wgGalleryImageWidth, $wgGalleryImageHeight + $wgGalleryCaptionLength, $wgGalleryShowBytes + +=== New features in 1.17 === + === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive without updating DB diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 45221aa3f1..21085334ba 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3039,6 +3039,31 @@ $wgThumbLimits = array( */ $wgThumbUpright = 0.75; +/** + * Adjust the default number of images per-row in the gallery. + */ +$wgGalleryImagesPerRow = 3; + +/** + * Adjust the width of the cells containing images in galleries (in "px") + */ +$wgGalleryImageWidth = 200; + +/** + * Adjust the height of the cells containing images in galleries (in "px") + */ +$wgGalleryImageHeight = 200; + +/** + * The length of caption to truncate to by default (in characters) + */ +$wgGalleryCaptionLength = 10; + +/** + * Should the gallerys in categoryes show the filesize in bytes? + */ +$wgGalleryShowBytes = true; + /** * On category pages, show thumbnail gallery for images belonging to that * category instead of listing them as articles. diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index c76c8e5779..64fa9cb269 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -32,20 +32,22 @@ class ImageGallery */ private $contextTitle = false; - private $mPerRow = 4; // How many images wide should the gallery be? - private $mWidths = 120, $mHeights = 120; // How wide/tall each thumbnail should be - private $mAttribs = array(); /** * Create a new image gallery object. */ function __construct( ) { + global $wgGalleryImagesPerRow, $wgGalleryImageWidth, $wgGalleryImageHeight, $wgGalleryShowBytes, $wgGalleryCaptionLength; $this->mImages = array(); - $this->mShowBytes = true; + $this->mShowBytes = $wgGalleryShowBytes; $this->mShowFilename = true; $this->mParser = false; $this->mHideBadImages = false; + $this->mPerRow = $wgGalleryImagesPerRow; + $this->mWidths = $wgGalleryImageWidth; + $this->mHeights = $wgGalleryImageHeight; + $this->mCaptionLength = $wgGalleryCaptionLength; } /** @@ -308,7 +310,7 @@ class ImageGallery $textlink = $this->mShowFilename ? $sk->link( $nt, - htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ), + htmlspecialchars( $wgLang->truncate( $nt->getText(), $this->mCaptionLength ) ), array(), array(), array( 'known', 'noclasses' )