From: Tim Starling Date: Sun, 2 Nov 2008 16:45:52 +0000 (+0000) Subject: * Set a special temporary directory for ImageMagick with $wgImageMagickTempDir X-Git-Tag: 1.31.0-rc.0~44468 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=3078cab2ea777a59c44b982f0cc31b0dfc77deb3;p=lhc%2Fweb%2Fwiklou.git * Set a special temporary directory for ImageMagick with $wgImageMagickTempDir --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d1e6f02044..d5d53300b2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -187,6 +187,8 @@ The following extensions are migrated into MediaWiki 1.14: directly blocked * (bug 13710) Allow to force "watch this" checkbox via URL using para "watchthis" * (bug 15125) Add Public Domain to default options when installing. Patch by Nathan Larson. +* Set a special temporary directory for ImageMagick with $wgImageMagickTempDir + === Bug fixes in 1.14 === * (bug 14907) DatabasePostgres::fieldType now defined. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 8d3817dd88..f6b9f38826 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1969,6 +1969,12 @@ $wgSharpenParameter = '0x0.4'; /** Reduction in linear dimensions below which sharpening will be enabled */ $wgSharpenReductionThreshold = 0.85; +/** + * Temporary directory used for ImageMagick. The directory must exist. Leave + * this set to false to let ImageMagick decide for itself. + */ +$wgImageMagickTempDir = false; + /** * Use another resizing converter, e.g. GraphicMagick * %s will be replaced with the source path, %d with the destination diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 9dbc40d833..b949ae3dca 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -41,7 +41,7 @@ class BitmapHandler extends ImageHandler { } function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) { - global $wgUseImageMagick, $wgImageMagickConvertCommand; + global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgImageMagickTempDir; global $wgCustomConvertCommand; global $wgSharpenParameter, $wgSharpenReductionThreshold; global $wgMaxAnimatedGifArea; @@ -122,6 +122,12 @@ class BitmapHandler extends ImageHandler { } } + if ( strval( $wgImageMagickTempDir ) !== '' ) { + $tempEnv = 'MAGICK_TMPDIR=' . wfEscapeShellArg( $wgImageMagickTempDir ) . ' '; + } else { + $tempEnv = ''; + } + # Specify white background color, will be used for transparent images # in Internet Explorer/Windows instead of default black. @@ -129,7 +135,9 @@ class BitmapHandler extends ImageHandler { # It seems that ImageMagick has a bug wherein it produces thumbnails of # the wrong size in the second case. - $cmd = wfEscapeShellArg($wgImageMagickConvertCommand) . + $cmd = + $tempEnv . + wfEscapeShellArg($wgImageMagickConvertCommand) . " {$quality} -background white -size {$physicalWidth} ". wfEscapeShellArg($srcPath . $frame) . $animation .