From: Brion Vibber Date: Mon, 27 Feb 2006 00:48:02 +0000 (+0000) Subject: * (bug 5086) Force image resize dimensions on ImageMagick, as for instance X-Git-Tag: 1.6.0~267 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=dddff772d13585bfc0f06c89c23a29e48033f2a2;p=lhc%2Fweb%2Fwiklou.git * (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. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b8ce1a7005..87f2b8880d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Image.php b/includes/Image.php index 96e892fc2f..309a1d7dcf 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -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' );