From f73704c36b101b66844dea6ff1d224318436d330 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 24 Nov 2010 22:50:46 +0000 Subject: [PATCH] Fix strange bug in ImageMagick call: if $params['comment'] was set to '' (which is explicitly done by the code in certain cases), the command line will contain -set comment -depth 8, causing the comment to be set to '-depth' and the file '8' to be read. Fix this by not adding the -set comment part at all if the comment is empty --- includes/media/Bitmap.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index c28e7eb9ce..bb1bbbaf43 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -238,8 +238,10 @@ class BitmapHandler extends ImageHandler { // or ImageMagick may decide your ratio is wrong and slice off // a pixel. " -thumbnail " . wfEscapeShellArg( "{$params['physicalDimensions']}!" ) . - // Add the source url as a comment to the thumb. - " -set comment " . wfEscapeShellArg( $this->escapeMagickProperty( $params['comment'] ) ) . + // Add the source url as a comment to the thumb, but don't add the flag if there's no comment + $params['comment'] !== '' + ? " -set comment " . wfEscapeShellArg( $this->escapeMagickProperty( $params['comment'] ) ) + : '' . " -depth 8 $sharpen" . " {$animation_post} " . wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) ) . " 2>&1"; -- 2.20.1