Merge "DatabaseMssql: Don't duplicate body of makeList()"
[lhc/web/wiklou.git] / includes / media / ImageHandler.php
index 8a12e7e..787f21e 100644 (file)
@@ -57,7 +57,7 @@ abstract class ImageHandler extends MediaHandler {
                } elseif ( isset( $params['width'] ) ) {
                        $width = $params['width'];
                } else {
-                       throw new MWException( 'No width specified to ' . __METHOD__ );
+                       throw new MediaTransformInvalidParametersException( 'No width specified to ' . __METHOD__ );
                }
 
                # Removed for ProofreadPage
@@ -269,4 +269,20 @@ abstract class ImageHandler extends MediaHandler {
                                ->numParams( $file->getWidth(), $file->getHeight() )->text();
                }
        }
+
+       public function sanitizeParamsForBucketing( $params ) {
+               $params = parent::sanitizeParamsForBucketing( $params );
+
+               // We unset the height parameters in order to let normaliseParams recalculate them
+               // Otherwise there might be a height discrepancy
+               if ( isset( $params['height'] ) ) {
+                       unset( $params['height'] );
+               }
+
+               if ( isset( $params['physicalHeight'] ) ) {
+                       unset( $params['physicalHeight'] );
+               }
+
+               return $params;
+       }
 }