/**
* @param File $image
- * @param array $params
+ * @param array &$params
* @return bool
*/
function normaliseParams( $image, &$params ) {
*/
protected function imageMagickSubsampling( $pixelFormat ) {
switch ( $pixelFormat ) {
- case 'yuv444':
- return [ '1x1', '1x1', '1x1' ];
- case 'yuv422':
- return [ '2x1', '1x1', '1x1' ];
- case 'yuv420':
- return [ '2x2', '1x1', '1x1' ];
- default:
- throw new MWException( 'Invalid pixel format for JPEG output' );
+ case 'yuv444':
+ return [ '1x1', '1x1', '1x1' ];
+ case 'yuv422':
+ return [ '2x1', '1x1', '1x1' ];
+ case 'yuv420':
+ return [ '2x2', '1x1', '1x1' ];
+ default:
+ throw new MWException( 'Invalid pixel format for JPEG output' );
}
}
'-layers', 'merge',
'-background', 'white',
];
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$xcfMeta = unserialize( $image->getMetadata() );
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( $xcfMeta
&& isset( $xcfMeta['colorType'] )
&& $xcfMeta['colorType'] === 'greyscale-alpha'
return $this->getMediaTransformError( $params, $errMsg );
}
+ if ( filesize( $params['srcPath'] ) === 0 ) {
+ $err = "Image file size seems to be zero.";
+ wfDebug( "$err\n" );
+ $errMsg = wfMessage( 'thumbnail_image-size-zero', $params['srcPath'] )->text();
+
+ return $this->getMediaTransformError( $params, $errMsg );
+ }
+
$src_image = call_user_func( $loader, $params['srcPath'] );
$rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ?