diff options
Diffstat (limited to 'includes/media')
-rw-r--r-- | includes/media/Bitmap.php | 8 | ||||
-rw-r--r-- | includes/media/GIF.php | 12 | ||||
-rw-r--r-- | includes/media/Generic.php | 18 |
3 files changed, 19 insertions, 19 deletions
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 5f796095..3a66d8c9 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -42,7 +42,7 @@ class BitmapHandler extends ImageHandler { return true; } } - + # Don't thumbnail an image so big that it will fill hard drives and send servers into swap # JPEG has the handy property of allowing thumbnailing without full decompression, so we make # an exception for it. @@ -55,10 +55,10 @@ class BitmapHandler extends ImageHandler { return true; } - + /** * Extracts the width/height if the image will be scaled before rotating - * + * * This will match the physical size/aspect ratio of the original image * prior to application of the rotation -- so for a portrait image that's * stored as raw landscape with 90-degress rotation, the resulting size @@ -305,7 +305,7 @@ class BitmapHandler extends ImageHandler { if ( strval( $wgImageMagickTempDir ) !== '' ) { $env['MAGICK_TMPDIR'] = $wgImageMagickTempDir; } - + $rotation = $this->getRotation( $image ); list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); diff --git a/includes/media/GIF.php b/includes/media/GIF.php index 325ceb9a..3bfa45a1 100644 --- a/includes/media/GIF.php +++ b/includes/media/GIF.php @@ -14,7 +14,7 @@ class GIFHandler extends BitmapHandler { const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata. - + function getMetadata( $image, $filename ) { try { $parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename ); @@ -118,7 +118,7 @@ class GIFHandler extends BitmapHandler { wfSuppressWarnings(); $metadata = unserialize($image->getMetadata()); wfRestoreWarnings(); - + if (!$metadata || $metadata['frameCount'] <= 1) { return $original; } @@ -126,19 +126,19 @@ class GIFHandler extends BitmapHandler { /* Preserve original image info string, but strip the last char ')' so we can add even more */ $info = array(); $info[] = $original; - + if ( $metadata['looped'] ) { $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' ); } - + if ( $metadata['frameCount'] > 1 ) { $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] ); } - + if ( $metadata['duration'] ) { $info[] = $wgLang->formatTimePeriod( $metadata['duration'] ); } - + return $wgLang->commaList( $info ); } } diff --git a/includes/media/Generic.php b/includes/media/Generic.php index 48735ebf..6ef21e1e 100644 --- a/includes/media/Generic.php +++ b/includes/media/Generic.php @@ -570,43 +570,43 @@ abstract class ImageHandler extends MediaHandler { $srcWidth = $image->getWidth( $params['page'] ); $srcHeight = $image->getHeight( $params['page'] ); - + if ( isset( $params['height'] ) && $params['height'] != -1 ) { # Height & width were both set if ( $params['width'] * $srcHeight > $params['height'] * $srcWidth ) { # Height is the relative smaller dimension, so scale width accordingly $params['width'] = wfFitBoxWidth( $srcWidth, $srcHeight, $params['height'] ); - + if ( $params['width'] == 0 ) { # Very small image, so we need to rely on client side scaling :( $params['width'] = 1; } - + $params['physicalWidth'] = $params['width']; } else { # Height was crap, unset it so that it will be calculated later unset( $params['height'] ); } } - + if ( !isset( $params['physicalWidth'] ) ) { # Passed all validations, so set the physicalWidth $params['physicalWidth'] = $params['width']; } - + # Because thumbs are only referred to by width, the height always needs # to be scaled by the width to keep the thumbnail sizes consistent, # even if it was set inside the if block above - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, + $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $params['physicalWidth'] ); - # Set the height if it was not validated in the if block higher up + # Set the height if it was not validated in the if block higher up if ( !isset( $params['height'] ) || $params['height'] == -1 ) { $params['height'] = $params['physicalHeight']; } - - if ( !$this->validateThumbParams( $params['physicalWidth'], + + if ( !$this->validateThumbParams( $params['physicalWidth'], $params['physicalHeight'], $srcWidth, $srcHeight, $mimeType ) ) { return false; } |