* Set a special temporary directory for ImageMagick with $wgImageMagickTempDir
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 2 Nov 2008 16:45:52 +0000 (16:45 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 2 Nov 2008 16:45:52 +0000 (16:45 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/media/Bitmap.php

index d1e6f02..d5d5330 100644 (file)
@@ -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.
index 8d3817d..f6b9f38 100644 (file)
@@ -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
index 9dbc40d..b949ae3 100644 (file)
@@ -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 .