diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /includes/media/Bitmap.php | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'includes/media/Bitmap.php')
-rw-r--r-- | includes/media/Bitmap.php | 64 |
1 files changed, 46 insertions, 18 deletions
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 619485cc..99ac854b 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -1,6 +1,21 @@ <?php /** - * Generic handler for bitmap images + * Generic handler for bitmap images. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html * * @file * @ingroup Media @@ -152,8 +167,11 @@ class BitmapHandler extends ImageHandler { if ( $flags & self::TRANSFORM_LATER ) { wfDebug( __METHOD__ . ": Transforming later per flags.\n" ); - return new ThumbnailImage( $image, $dstUrl, $scalerParams['clientWidth'], - $scalerParams['clientHeight'], false ); + $params = array( + 'width' => $scalerParams['clientWidth'], + 'height' => $scalerParams['clientHeight'] + ); + return new ThumbnailImage( $image, $dstUrl, false, $params ); } # Try to make a target path for the thumbnail @@ -205,8 +223,11 @@ class BitmapHandler extends ImageHandler { } elseif ( $mto ) { return $mto; } else { - return new ThumbnailImage( $image, $dstUrl, $scalerParams['clientWidth'], - $scalerParams['clientHeight'], $dstPath ); + $params = array( + 'width' => $scalerParams['clientWidth'], + 'height' => $scalerParams['clientHeight'] + ); + return new ThumbnailImage( $image, $dstUrl, $dstPath, $params ); } } @@ -243,14 +264,17 @@ class BitmapHandler extends ImageHandler { * client side * * @param $image File File associated with this thumbnail - * @param $params array Array with scaler params + * @param $scalerParams array Array with scaler params * @return ThumbnailImage * - * @fixme no rotation support + * @todo fixme: no rotation support */ - protected function getClientScalingThumbnailImage( $image, $params ) { - return new ThumbnailImage( $image, $image->getURL(), - $params['clientWidth'], $params['clientHeight'], null ); + protected function getClientScalingThumbnailImage( $image, $scalerParams ) { + $params = array( + 'width' => $scalerParams['clientWidth'], + 'height' => $scalerParams['clientHeight'] + ); + return new ThumbnailImage( $image, $image->getURL(), null, $params ); } /** @@ -259,7 +283,7 @@ class BitmapHandler extends ImageHandler { * @param $image File File associated with this thumbnail * @param $params array Array with scaler params * - * @return MediaTransformError Error object if error occured, false (=no error) otherwise + * @return MediaTransformError Error object if error occurred, false (=no error) otherwise */ protected function transformImageMagick( $image, $params ) { # use ImageMagick @@ -358,7 +382,7 @@ class BitmapHandler extends ImageHandler { * @param $image File File associated with this thumbnail * @param $params array Array with scaler params * - * @return MediaTransformError Error object if error occured, false (=no error) otherwise + * @return MediaTransformError Error object if error occurred, false (=no error) otherwise */ protected function transformImageMagickExt( $image, $params ) { global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea; @@ -435,7 +459,7 @@ class BitmapHandler extends ImageHandler { * @param $image File File associated with this thumbnail * @param $params array Array with scaler params * - * @return MediaTransformError Error object if error occured, false (=no error) otherwise + * @return MediaTransformError Error object if error occurred, false (=no error) otherwise */ protected function transformCustom( $image, $params ) { # Use a custom convert command @@ -462,7 +486,7 @@ class BitmapHandler extends ImageHandler { } /** - * Log an error that occured in an external process + * Log an error that occurred in an external process * * @param $retval int * @param $err int @@ -491,7 +515,7 @@ class BitmapHandler extends ImageHandler { * @param $image File File associated with this thumbnail * @param $params array Array with scaler params * - * @return MediaTransformError Error object if error occured, false (=no error) otherwise + * @return MediaTransformError Error object if error occurred, false (=no error) otherwise */ protected function transformGd( $image, $params ) { # Use PHP's builtin GD library functions. @@ -509,7 +533,7 @@ class BitmapHandler extends ImageHandler { if ( !isset( $typemap[$params['mimeType']] ) ) { $err = 'Image type not supported'; wfDebug( "$err\n" ); - $errMsg = wfMsg( 'thumbnail_image-type' ); + $errMsg = wfMessage( 'thumbnail_image-type' )->text(); return $this->getMediaTransformError( $params, $errMsg ); } list( $loader, $colorStyle, $saveType ) = $typemap[$params['mimeType']]; @@ -517,14 +541,14 @@ class BitmapHandler extends ImageHandler { if ( !function_exists( $loader ) ) { $err = "Incomplete GD library configuration: missing function $loader"; wfDebug( "$err\n" ); - $errMsg = wfMsg( 'thumbnail_gd-library', $loader ); + $errMsg = wfMessage( 'thumbnail_gd-library', $loader )->text(); return $this->getMediaTransformError( $params, $errMsg ); } if ( !file_exists( $params['srcPath'] ) ) { $err = "File seems to be missing: {$params['srcPath']}"; wfDebug( "$err\n" ); - $errMsg = wfMsg( 'thumbnail_image-missing', $params['srcPath'] ); + $errMsg = wfMessage( 'thumbnail_image-missing', $params['srcPath'] )->text(); return $this->getMediaTransformError( $params, $errMsg ); } @@ -572,6 +596,7 @@ class BitmapHandler extends ImageHandler { /** * Escape a string for ImageMagick's property input (e.g. -set -comment) * See InterpretImageProperties() in magick/property.c + * @return mixed|string */ function escapeMagickProperty( $s ) { // Double the backslashes @@ -599,6 +624,7 @@ class BitmapHandler extends ImageHandler { * * @param $path string The file path * @param $scene string The scene specification, or false if there is none + * @return string */ function escapeMagickInput( $path, $scene = false ) { # Die on initial metacharacters (caller should prepend path) @@ -616,6 +642,7 @@ class BitmapHandler extends ImageHandler { /** * Escape a string for ImageMagick's output filename. See * InterpretImageFilename() in magick/image.c. + * @return string */ function escapeMagickOutput( $path, $scene = false ) { $path = str_replace( '%', '%%', $path ); @@ -628,6 +655,7 @@ class BitmapHandler extends ImageHandler { * * @param $path string The file path * @param $scene string The scene specification, or false if there is none + * @return string */ protected function escapeMagickPath( $path, $scene = false ) { # Die on format specifiers (other than drive letters). The regex is |