/**
* @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' );
}
}
* @param File $image File associated with this thumbnail
* @param array $params Array with scaler params
*
- * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+ * @return MediaTransformError|bool Error object if error occurred, false (=no error) otherwise
*/
protected function transformImageMagick( $image, $params ) {
# use ImageMagick
'-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'
* @param File $image File associated with this thumbnail
* @param array $params Array with scaler params
*
- * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+ * @return MediaTransformError Error|bool object if error occurred, false (=no error) otherwise
*/
protected function transformImageMagickExt( $image, $params ) {
global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
* @param File $image File associated with this thumbnail
* @param array $params Array with scaler params
*
- * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+ * @return MediaTransformError Error|bool object if error occurred, false (=no error) otherwise
*/
protected function transformCustom( $image, $params ) {
# Use a custom convert command
* @param File $image File associated with this thumbnail
* @param array $params Array with scaler params
*
- * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+ * @return MediaTransformError|bool Error object if error occurred, false (=no error) otherwise
*/
protected function transformGd( $image, $params ) {
# Use PHP's builtin GD library functions.