Fix strange bug in ImageMagick call: if $params['comment'] was set to '' (which is...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 24 Nov 2010 22:50:46 +0000 (22:50 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 24 Nov 2010 22:50:46 +0000 (22:50 +0000)
includes/media/Bitmap.php

index c28e7eb..bb1bbba 100644 (file)
@@ -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";