* (bug 5086) Force image resize dimensions on ImageMagick, as for instance
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 27 Feb 2006 00:48:02 +0000 (00:48 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 27 Feb 2006 00:48:02 +0000 (00:48 +0000)
  "-resize 100x35!"; some thumbs were off due to differences in rounding and
  would be generated smaller than expected.

RELEASE-NOTES
includes/Image.php

index b8ce1a7..87f2b88 100644 (file)
@@ -663,6 +663,10 @@ fully support the editing toolbar, but was found to be too confusing.
   broke use of legitimate multiple whitespace characters in bracketed link.
 * (bug 4838) Add relative oldids (prev, next, cur) for raw pages
   Patch by Lupin
+* (bug 5086) Force image resize dimensions on ImageMagick, as for instance
+  "-resize 100x35!"; some thumbs were off due to differences in rounding and
+  would be generated smaller than expected.
+
 
 === Caveats ===
 
index 96e892f..309a1d7 100644 (file)
@@ -1095,7 +1095,12 @@ class Image
                        
                        $cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
                                " {$quality} -background white -size {$width} ".
-                               wfEscapeShellArg($this->imagePath) . " -resize {$width}x{$height} -depth 8 " .
+                               wfEscapeShellArg($this->imagePath) .
+                               // For the -resize option a "!" is needed to force exact size,
+                               // or ImageMagick may decide your ratio is wrong and slice off
+                               // a pixel.
+                               " -resize " . wfEscapeShellArg( "{$width}x{$height}!" ) .
+                               " -depth 8 " .
                                wfEscapeShellArg($thumbPath) . " 2>&1";
                        wfDebug("reallyRenderThumb: running ImageMagick: $cmd\n");
                        wfProfileIn( 'convert' );