X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FJpeg.php;h=ee7eff86ec42ccc98886c31c260b53e83577fd4b;hb=e92d87c26c408441d8c229fc1e9c7e0bcd93898a;hp=1feb3788d4a274e0654f5ef5f6fc3e688ea3fd08;hpb=7c4eccb559754ea70c005dd87705af6bf46089c5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/Jpeg.php b/includes/media/Jpeg.php index 1feb3788d4..ee7eff86ec 100644 --- a/includes/media/Jpeg.php +++ b/includes/media/Jpeg.php @@ -31,7 +31,6 @@ * @ingroup Media */ class JpegHandler extends ExifBitmapHandler { - function getMetadata( $image, $filename ) { try { $meta = BitmapMetadataHandler::Jpeg( $filename ); @@ -40,10 +39,11 @@ class JpegHandler extends ExifBitmapHandler { throw new MWException( 'Metadata array is not an array' ); } $meta['MEDIAWIKI_EXIF_VERSION'] = Exif::version(); + return serialize( $meta ); - } - catch ( MWException $e ) { - // BitmapMetadataHandler throws an exception in certain exceptional cases like if file does not exist. + } catch ( MWException $e ) { + // BitmapMetadataHandler throws an exception in certain exceptional + // cases like if file does not exist. wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" ); /* This used to use 0 (ExifBitmapHandler::OLD_BROKEN_FILE) for the cases @@ -55,14 +55,15 @@ class JpegHandler extends ExifBitmapHandler { * Thus switch to using -1 to denote only a broken file, and use an array with only * MEDIAWIKI_EXIF_VERSION to denote no props. */ + return ExifBitmapHandler::BROKEN_FILE; } } /** - * @param $file File + * @param File $file * @param array $params Rotate parameters. - * 'rotation' clockwise rotation in degrees, allowed are multiples of 90 + * 'rotation' clockwise rotation in degrees, allowed are multiples of 90 * @since 1.21 * @return bool */ @@ -75,20 +76,22 @@ class JpegHandler extends ExifBitmapHandler { $cmd = wfEscapeShellArg( $wgJpegTran ) . " -rotate " . wfEscapeShellArg( $rotation ) . " -outfile " . wfEscapeShellArg( $params['dstPath'] ) . - " " . wfEscapeShellArg( $params['srcPath'] ) . " 2>&1"; + " " . wfEscapeShellArg( $params['srcPath'] ); wfDebug( __METHOD__ . ": running jpgtran: $cmd\n" ); wfProfileIn( 'jpegtran' ); $retval = 0; - $err = wfShellExec( $cmd, $retval, $env ); + // @todo FIXME Undefined variable $env + $err = wfShellExecWithStderr( $cmd, $retval, $env ); wfProfileOut( 'jpegtran' ); if ( $retval !== 0 ) { $this->logErrorForExternalProcess( $retval, $err, $cmd ); + return new MediaTransformError( 'thumbnail_error', 0, 0, $err ); } + return false; } else { return parent::rotate( $file, $params ); } } - }