[!!!][TASK] Rename GFX settings referring to IM in their name 85/42385/18
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Mon, 10 Aug 2015 21:42:23 +0000 (23:42 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 15 Jan 2016 15:27:59 +0000 (16:27 +0100)
Rename GFX settings to more generic names that do not refer to ImageMagick
or no longer supported versions of ImageMagick in their name. The
values for the setting of the graphics processor have been changed to
refer to the tools by name and not by acronym.

The Install Tool has been extended to perform a silent migration of the
affected settings.

Resolves: #43085
Releases: master
Change-Id: I41450eafbadb5782a55f876a87f2bc0ff0704d62
Reviewed-on: https://review.typo3.org/42385
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
21 files changed:
typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php
typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php
typo3/sysext/core/Classes/Utility/CommandUtility.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-43085-RenamedGraphicsProcessorSettings.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php
typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php
typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php
typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php
typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php
typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Resources/Private/Partials/Action/Tool/TestSetup/AboutImageHandling.html
typo3/sysext/install/Resources/Private/Partials/Action/Tool/TestSetup/CurrentConfiguration.html
typo3/sysext/install/Resources/Public/Images/TestReference/About.txt
typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php
typo3/sysext/t3editor/Resources/Private/tsref.xml
typo3/sysext/t3editor/Resources/Public/JavaScript/parse_typoscript/tokenizetyposcript.js

index de83c55..0649b37 100644 (file)
@@ -31,11 +31,11 @@ use TYPO3\CMS\Core\Utility\MathUtility;
 class GraphicalFunctions
 {
     /**
-     * If set, there is no frame pointer prepended to the filenames.
+     * If set, the frame pointer is appended to the filenames.
      *
      * @var bool
      */
-    public $noFramePrepended = 0;
+    public $addFrameSelection = true;
 
     /**
      * This should be changed to 'png' if you want this class to read/make PNG-files instead!
@@ -347,16 +347,13 @@ class GraphicalFunctions
             $this->png_truecolor = true;
         }
 
-        if ($gfxConf['colorspace'] && in_array($gfxConf['colorspace'], $this->allowedColorSpaceNames, true)) {
-            $this->colorspace = $gfxConf['colorspace'];
+        if ($gfxConf['processor_colorspace'] && in_array($gfxConf['processor_colorspace'], $this->allowedColorSpaceNames, true)) {
+            $this->colorspace = $gfxConf['processor_colorspace'];
         }
 
-        if (!$gfxConf['im']) {
+        if (!$gfxConf['processor_enabled']) {
             $this->NO_IMAGE_MAGICK = 1;
         }
-        if (!$this->NO_IMAGE_MAGICK && (!$gfxConf['im_version_5'] || $gfxConf['im_version_5'] === 'im4' || $gfxConf['im_version_5'] === 'im5')) {
-            throw new \RuntimeException('Your TYPO3 installation is configured to use an old version of ImageMagick, which is not supported anymore. ' . 'Please upgrade to ImageMagick version 6 or GraphicksMagick and set $TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\'] appropriately.', 1305059666);
-        }
         // When GIFBUILDER gets used in truecolor mode
         // No colors parameter if we generate truecolor images.
         if ($this->png_truecolor) {
@@ -365,9 +362,7 @@ class GraphicalFunctions
         // Setting default JPG parameters:
         $this->jpegQuality = MathUtility::forceIntegerInRange($gfxConf['jpg_quality'], 10, 100, 75);
         $this->cmds['jpg'] = ($this->cmds['jpeg'] = '-colorspace ' . $this->colorspace . ' -sharpen 50 -quality ' . $this->jpegQuality);
-        if ($gfxConf['im_noFramePrepended']) {
-            $this->noFramePrepended = 1;
-        }
+        $this->addFrameSelection = (bool)$gfxConf['processor_allowFrameSelection'];
         if ($gfxConf['gdlib_png']) {
             $this->gifExtension = 'png';
         }
@@ -379,16 +374,16 @@ class GraphicalFunctions
         $this->NO_IM_EFFECTS = 1;
         $this->cmds['jpg'] = ($this->cmds['jpeg'] = '-colorspace ' . $this->colorspace . ' -quality ' . $this->jpegQuality);
 
-        // ... but if 'im_v5effects' is set, enable effects
-        if ($gfxConf['im_v5effects']) {
+        // ... but if 'processor_effects' is set, enable effects
+        if ($gfxConf['processor_effects']) {
             $this->NO_IM_EFFECTS = 0;
             $this->V5_EFFECTS = 1;
-            if ($gfxConf['im_v5effects'] > 0) {
+            if ($gfxConf['processor_effects'] > 0) {
                 $this->cmds['jpg'] = ($this->cmds['jpeg'] = '-colorspace ' . $this->colorspace . ' -quality ' . (int)$gfxConf['jpg_quality'] . $this->v5_sharpen(10));
             }
         }
         // Secures that images are not scaled up.
-        if ($gfxConf['im_noScaleUp']) {
+        if (!$gfxConf['processor_allowUpscaling']) {
             $this->mayScaleUp = 0;
         }
         $this->csConvObj = GeneralUtility::makeInstance(CharsetConverter::class);
@@ -2227,7 +2222,7 @@ class GraphicalFunctions
         }
         $info[0] = $data[0];
         $info[1] = $data[1];
-        $frame = $this->noFramePrepended ? '' : (int)$frame;
+        $frame = $this->addFrameSelection ? (int)$frame : '';
         if (!$params) {
             $params = $this->cmds[$newExt];
         }
@@ -2532,7 +2527,7 @@ class GraphicalFunctions
             return null;
         }
 
-        $frame = $this->noFramePrepended ? '' : '[0]';
+        $frame = $this->addFrameSelection ? '[0]' : '';
         $cmd = GeneralUtility::imageMagickCommand('identify', CommandUtility::escapeShellArgument($imagefile) . $frame);
         $returnVal = array();
         CommandUtility::exec($cmd, $returnVal);
@@ -2574,13 +2569,9 @@ class GraphicalFunctions
         if ($this->NO_IMAGE_MAGICK) {
             return '';
         }
-        // Unless noFramePrepended is set in the Install Tool, a frame number is added to
+        // If addFrameSelection is set in the Install Tool, a frame number is added to
         // select a specific page of the image (by default this will be the first page)
-        if (!$this->noFramePrepended) {
-            $frame = '[' . (int)$frame . ']';
-        } else {
-            $frame = '';
-        }
+        $frame  = $this->addFrameSelection ? '[' . (int)$frame . ']' : '';
         $cmd = GeneralUtility::imageMagickCommand('convert', $params . ' ' . CommandUtility::escapeShellArgument($input . $frame) . ' ' . CommandUtility::escapeShellArgument($output));
         $this->IM_commands[] = array($output, $cmd);
         $ret = CommandUtility::exec($cmd);
@@ -2630,7 +2621,7 @@ class GraphicalFunctions
      *
      * The function takes a file-reference, $theFile, and saves it again through GD or ImageMagick in order to compress the file
      * GIF:
-     * If $type is not set, the compression is done with ImageMagick (provided that $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] is pointing to the path of a lzw-enabled version of 'convert') else with GD (should be RLE-enabled!)
+     * If $type is not set, the compression is done with ImageMagick (provided that $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw'] is pointing to the path of a lzw-enabled version of 'convert') else with GD (should be RLE-enabled!)
      * If $type is set to either 'IM' or 'GD' the compression is done with ImageMagick and GD respectively
      * PNG:
      * No changes.
@@ -2649,12 +2640,12 @@ class GraphicalFunctions
             return '';
         }
 
-        if (($type === 'IM' || !$type) && $gfxConf['im'] && $gfxConf['im_path_lzw']) {
+        if (($type === 'IM' || !$type) && $gfxConf['processor_enabled'] && $gfxConf['processor_path_lzw']) {
             // Use temporary file to prevent problems with read and write lock on same file on network file systems
             $temporaryName = dirname($theFile) . '/' . md5(uniqid('', true)) . '.gif';
             // Rename could fail, if a simultaneous thread is currently working on the same thing
             if (@rename($theFile, $temporaryName)) {
-                $cmd = GeneralUtility::imageMagickCommand('convert', '"' . $temporaryName . '" "' . $theFile . '"', $gfxConf['im_path_lzw']);
+                $cmd = GeneralUtility::imageMagickCommand('convert', '"' . $temporaryName . '" "' . $theFile . '"', $gfxConf['processor_path_lzw']);
                 CommandUtility::exec($cmd);
                 unlink($temporaryName);
             }
@@ -2687,7 +2678,7 @@ class GraphicalFunctions
      */
     public static function readPngGif($theFile, $output_png = false)
     {
-        if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['im'] || !@is_file($theFile)) {
+        if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'] || !@is_file($theFile)) {
             return null;
         }
 
@@ -2701,7 +2692,7 @@ class GraphicalFunctions
         }
         $newFile = PATH_site . 'typo3temp/assets/images/' . md5($theFile . '|' . filemtime($theFile)) . ($output_png ? '.png' : '.gif');
         $cmd = GeneralUtility::imageMagickCommand(
-            'convert', '"' . $theFile . '" "' . $newFile . '"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']
+            'convert', '"' . $theFile . '" "' . $newFile . '"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path']
         );
         CommandUtility::exec($cmd);
         if (@is_file($newFile)) {
index 47c5612..ef49bd9 100644 (file)
@@ -111,7 +111,7 @@ class LocalCropScaleMaskHelper
         }
 
         // Normal situation (no masking)
-        if (!(is_array($configuration['maskImages']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'])) {
+        if (!(is_array($configuration['maskImages']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'])) {
 
             // SVG
             if ($croppedImage === null && $sourceFile->getExtension() === 'svg') {
@@ -142,7 +142,7 @@ class LocalCropScaleMaskHelper
             $maskBackgroundImage = $configuration['maskImages']['backgroundImage'];
             if ($maskImage instanceof Resource\FileInterface && $maskBackgroundImage instanceof Resource\FileInterface) {
                 $temporaryExtension = 'png';
-                if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_gif']) {
+                if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowTemporaryMasksAsPng']) {
                     // If ImageMagick version 5+
                     $temporaryExtension = $gifBuilder->gifExtension;
                 }
@@ -301,7 +301,7 @@ class LocalCropScaleMaskHelper
         $configuration = $task->getTargetFile()->getProcessingConfiguration();
         $targetFileExtension = $task->getSourceFile()->getExtension();
         $processedFileExtension = $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'] ? 'png' : 'gif';
-        if (is_array($configuration['maskImages']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'] && $task->getSourceFile()->getExtension() != $processedFileExtension) {
+        if (is_array($configuration['maskImages']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'] && $task->getSourceFile()->getExtension() != $processedFileExtension) {
             $targetFileExtension = 'jpg';
         } elseif ($configuration['fileExtension']) {
             $targetFileExtension = $configuration['fileExtension'];
@@ -321,8 +321,11 @@ class LocalCropScaleMaskHelper
     {
         // Strips profile information of image to save some space:
         if (isset($configuration['stripProfile'])) {
-            if ($configuration['stripProfile']) {
-                $parameters = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_stripProfileCommand'] . $parameters;
+            if (
+                $configuration['stripProfile']
+                && $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripColorProfileCommand'] !== ''
+            ) {
+                $parameters = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripProfileCommand'] . $parameters;
             } else {
                 $parameters .= '###SkipStripProfile###';
             }
index 5154d78..7346802 100644 (file)
@@ -127,7 +127,7 @@ class LocalPreviewHelper
             );
         } else {
             // Create the temporary file
-            if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) {
+            if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled']) {
                 $parameters = '-sample ' . $configuration['width'] . 'x' . $configuration['height'] . ' '
                     . CommandUtility::escapeShellArgument($originalFileName) . '[0] ' . CommandUtility::escapeShellArgument($targetFilePath);
 
index 8e69348..22242d1 100644 (file)
@@ -34,7 +34,7 @@ namespace TYPO3\CMS\Core\Utility;
  * checkCommand() returns TRUE if a command is available
  *
  * Search paths that are included:
- * $TYPO3_CONF_VARS['GFX']['im_path_lzw'] or $TYPO3_CONF_VARS['GFX']['im_path']
+ * $TYPO3_CONF_VARS['GFX']['processor_path_lzw'] or $TYPO3_CONF_VARS['GFX']['processor_path']
  * $TYPO3_CONF_VARS['SYS']['binPath']
  * $GLOBALS['_SERVER']['PATH']
  * '/usr/bin/,/usr/local/bin/' on Unix
@@ -89,49 +89,41 @@ class CommandUtility
      * @param string $command Command to be run: identify, convert or combine/composite
      * @param string $parameters The parameters string
      * @param string $path Override the default path (e.g. used by the install tool)
-     * @return string Compiled command that deals with IM6 & GraphicsMagick
+     * @return string Compiled command that deals with ImageMagick & GraphicsMagick
      */
     public static function imageMagickCommand($command, $parameters, $path = '')
     {
         $gfxConf = $GLOBALS['TYPO3_CONF_VARS']['GFX'];
         $isExt = TYPO3_OS == 'WIN' ? '.exe' : '';
-        $switchCompositeParameters = false;
         if (!$path) {
-            $path = $gfxConf['im_path'];
+            $path = $gfxConf['processor_path'];
         }
         $path = GeneralUtility::fixWindowsFilePath($path);
-        $im_version = strtolower($gfxConf['im_version_5']);
         // This is only used internally, has no effect outside
         if ($command === 'combine') {
             $command = 'composite';
         }
         // Compile the path & command
-        if ($im_version === 'gm') {
-            $switchCompositeParameters = true;
+        if ($gfxConf['processor'] === 'GraphicsMagick') {
             $path = self::escapeShellArgument($path . 'gm' . $isExt) . ' ' . self::escapeShellArgument($command);
         } else {
-            if ($im_version === 'im6') {
-                $switchCompositeParameters = true;
-            }
-            $path = self::escapeShellArgument($path . ($command == 'composite' ? 'composite' : $command) . $isExt);
+            $path = self::escapeShellArgument($path . ($command === 'composite' ? 'composite' : $command) . $isExt);
         }
         // strip profile information for thumbnails and reduce their size
-        if ($parameters && $command != 'identify' && $gfxConf['im_useStripProfileByDefault'] && $gfxConf['im_stripProfileCommand'] != '') {
-            if (strpos($parameters, $gfxConf['im_stripProfileCommand']) === false) {
+        if ($parameters && $command !== 'identify' && $gfxConf['processor_stripColorProfileByDefault'] && $gfxConf['processor_stripColorProfileCommand'] !== '') {
+            if (strpos($parameters, $gfxConf['processor_stripColorProfileCommand']) === false) {
                 // Determine whether the strip profile action has be disabled by TypoScript:
                 if ($parameters !== '-version' && strpos($parameters, '###SkipStripProfile###') === false) {
-                    $parameters = $gfxConf['im_stripProfileCommand'] . ' ' . $parameters;
+                    $parameters = $gfxConf['processor_stripColorProfileCommand'] . ' ' . $parameters;
                 } else {
                     $parameters = str_replace('###SkipStripProfile###', '', $parameters);
                 }
             }
         }
         $cmdLine = $path . ' ' . $parameters;
-        // Because of some weird incompatibilities between ImageMagick 4 and 6 (plus GraphicsMagick),
-        // it is needed to change the parameters order under some preconditions
-        if ($command == 'composite' && $switchCompositeParameters) {
+        // It is needed to change the parameters order when a mask image has been specified
+        if ($command === 'composite') {
             $paramsArr = GeneralUtility::unQuoteFilenames($parameters);
-            // The mask image has been specified => swap the parameters
             $paramsArrCount = count($paramsArr);
             if ($paramsArrCount > 5) {
                 $tmp = $paramsArr[$paramsArrCount - 3];
@@ -382,8 +374,8 @@ class CommandUtility
         $sysPathArr = array();
 
             // Image magick paths first
-            // im_path_lzw take precedence over im_path
-        if (($imPath = ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] ?: $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']))) {
+            // processor_path_lzw take precedence over processor_path
+        if (($imPath = ($GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw'] ?: $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path']))) {
             $imPath = self::fixPath($imPath);
             $pathsArr[$imPath] = $imPath;
         }
index 2683166..e77a5ee 100755 (executable)
@@ -4729,7 +4729,7 @@ class GeneralUtility
      * @param string $command Command to be run: identify, convert or combine/composite
      * @param string $parameters The parameters string
      * @param string $path Override the default path (e.g. used by the install tool)
-     * @return string Compiled command that deals with IM6 & GraphicsMagick
+     * @return string Compiled command that deals with ImageMagick & GraphicsMagick
      */
     public static function imageMagickCommand($command, $parameters, $path = '')
     {
index b61c00c..5da23f9 100644 (file)
 return array(
     'GFX' => array(
         // Configuration of the image processing features in TYPO3. 'IM' and 'GD' are short for ImageMagick and GD library respectively.
-        'image_processing' => true,                        // Boolean: Enables image processing features. Disabling this means NO image processing with either GD or IM!
         'thumbnails' => true,                            // Boolean: Enables the use of thumbnails in the backend interface.
         'thumbnails_png' => 0,                            // Bits. Bit0: If set, thumbnails from non-jpegs will be 'png', otherwise 'gif' (0=gif/1=png). Bit1: Even JPG's will be converted to png or gif (2=gif/3=png)
         'gif_compress' => true,                            // Boolean: Enables the use of the \TYPO3\CMS\Core\Utility\GeneralUtility::gifCompress() workaround function for compressing giffiles made with GD or IM, which probably use only RLE or no compression at all.
         'imagefile_ext' => 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg',// Commalist of file extensions perceived as images by TYPO3. List should be set to 'gif,png,jpeg,jpg' if IM is not available. Lowercase and no spaces between!
         'gdlib' => true,                                // Boolean: Enables the use of GD.
         'gdlib_png' => false,                            // Boolean: Enables the use of GD, with PNG only. This means that all items normally generated as gif-files will be png-files instead!
-        'im' => true,                                    // Boolean: Enables the use of IM.
-        'im_path' => '/usr/bin/',                        // Path to the IM tools 'convert', 'combine', 'identify'.
-        'im_path_lzw' => '/usr/bin/',                    // Path to the IM tool 'convert' with LZW enabled! See 'gif_compress'. If your version 4.2.9 of ImageMagick is compiled with LZW you may leave this field blank AND disable the flag 'gif_compress'! Tip: You can call LZW 'convert' with a prefix like 'myver_convert' by setting this path with it, eg. '/usr/bin/myver_' instead of just '/usr/bin/'.
-        'im_version_5' => 'im6',                        // String: Set this either to "im6" or "gm" (uses GraphicsMagick instead of ImageMagick). Setting this value will automatically configure some settings for use with the specified program version.
-        'im_v5effects' => 0,                            // <p>Integer (-1, 0, 1)</p><dl><dt>0</dt><dd>disabled</dd><dt>-1</dt><dd>Do not sharpen images by default</dd><dt>1</dt><dd>All; blur and sharpening is allowed in ImageMagick.</dd></dl>
-        'im_mask_temp_ext_gif' => 1,                    // Boolean: This should be set if ImageMagick is version 5+. This is used in \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer for masking images and the extension png is normally used because it's faster than gif for temporary files. But png seems not to work with some IM 5+ versions, so...
-        'im_noScaleUp' => false,                        // Boolean: If set, images are not being scaled up if told so (in \TYPO3\CMS\Core\Imaging\GraphicalFunctions)
-        'im_noFramePrepended' => false,                    // Boolean: If set, the [x] frame indicator is NOT prepended to filenames in stdgraphic. Some IM5+ version didn't work at all with the typical [0]-prefix, which allow multipage pdf's and animated gif's to be scaled only for the first frame/page and that seriously cuts down rendering time. Set this flag only if your ImageMagick version cannot find the files. Notice that changing this flag causes temporary filenames to change, thus the server will begin scaling images again which were previously cached.
-        'im_stripProfileCommand' => '+profile \'*\'',    // String: Specify the command to strip the profile information, which can reduce thumbnail size up to 60KB. Command can differ in IM/GM, IM also know the -strip command. See <a href="http://www.imagemagick.org/Usage/thumbnails/#profiles" target="_blank">imagemagick.org</a> for details
-        'im_useStripProfileByDefault' => true,            // Boolean: If set, the im_stripProfileCommand is used with all IM Image operations by default. See tsRef for setting this parameter explocit for IMAGE generation.
+        'processor_enabled' => true,                    // Boolean: Enables the use of Image- or GraphicsMagick.
+        'processor_path' => '/usr/bin/',                // Path to the IM tools 'convert', 'combine', 'identify'.
+        'processor_path_lzw' => '/usr/bin/',            // Path to the IM tool 'convert' with LZW enabled! See 'gif_compress'. If your version 4.2.9 of ImageMagick is compiled with LZW you may leave this field blank AND disable the flag 'gif_compress'! Tip: You can call LZW 'convert' with a prefix like 'myver_convert' by setting this path with it, eg. '/usr/bin/myver_' instead of just '/usr/bin/'.
+        'processor' => 'ImageMagick',                    // String: Set this either to "ImageMagick" or "GraphicsMagick". Setting this value will automatically configure some settings for use with the specified program version.
+        'processor_effects' => 0,                        // <p>Integer (-1, 0, 1)</p><dl><dt>0</dt><dd>disabled</dd><dt>-1</dt><dd>Do not sharpen images by default</dd><dt>1</dt><dd>All; blur and sharpening is allowed in ImageMagick.</dd></dl>
+        'processor_allowUpscaling' => true,                // Boolean: If set, images can be scaled up if told so (in \TYPO3\CMS\Core\Imaging\GraphicalFunctions)
+        'processor_allowFrameSelection' => true,            // Boolean: If set, the [x] frame selector is appended to input filenames in stdgraphic. This speeds up image processing for PDF files considerably. Disable if your image processor or environment can't cope with the frame selection.
+        'processor_allowTemporaryMasksAsPng' => false,        // Boolean: This should be set if your processor supports using PNGs as masks as this is usually faster.
+        'processor_stripColorProfileByDefault' => true,            // Boolean: If set, the processor_stripColorProfileCommand is used with all processor image operations by default. See tsRef for setting this parameter explicitly for IMAGE generation.
+        'processor_stripColorProfileCommand' => '+profile \'*\'',    // String: Specify the command to strip the profile information, which can reduce thumbnail size up to 60KB. Command can differ in IM/GM, IM also know the -strip command. See <a href="http://www.imagemagick.org/Usage/thumbnails/#profiles" target="_blank">imagemagick.org</a> for details
+        'processor_colorspace' => 'RGB',                            // String: Specify the colorspace to use. Some ImageMagick versions (like 6.7.0 and above) use the sRGB colorspace, so all images are darker then the original. <br />Possible Values: CMY, CMYK, Gray, HCL, HSB, HSL, HWB, Lab, LCH, LMS, Log, Luv, OHTA, Rec601Luma, Rec601YCbCr, Rec709Luma, Rec709YCbCr, RGB, sRGB, Transparent, XYZ, YCbCr, YCC, YIQ, YCbCr, YUV
         'jpg_quality' => 70,                            // Integer: Default JPEG generation quality
         'png_truecolor' => true,
-        'colorspace' => 'RGB',                            // String: Specify the colorspace to use. Some ImageMagick versions (like 6.7.0 and above) use the sRGB colorspace, so all images are darker then the original. <br />Possible Values: CMY, CMYK, Gray, HCL, HSB, HSL, HWB, Lab, LCH, LMS, Log, Luv, OHTA, Rec601Luma, Rec601YCbCr, Rec709Luma, Rec709YCbCr, RGB, sRGB, Transparent, XYZ, YCbCr, YCC, YIQ, YCbCr, YUV
     ),
     'SYS' => array(
         // System related concerning both frontend and backend.
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-43085-RenamedGraphicsProcessorSettings.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-43085-RenamedGraphicsProcessorSettings.rst
new file mode 100644 (file)
index 0000000..938621a
--- /dev/null
@@ -0,0 +1,64 @@
+===========================================================================
+Breaking: #43085 - Change GFX settings prefix im\_* to generic processor\_*
+===========================================================================
+
+Description
+===========
+
+Graphics processor settings for Image- or GraphicsMagick have been renamed
+in ``LocalConfiguration.php``. The former prefix ``im\_`` has been replaced with
+the unified prefix ``processor\_``.
+
+Negative namings like ``noScaleUp`` have been changed positive counterparts.
+During the conversion the previous configuration values are negated to reflect
+the changes in semantics of these options.
+
+In addition references to specific versions of ImageMagick/GraphicsMagick
+have been removed from settings names and values. For a detailed list of
+changes please consult the information in the migration section.
+
+The unused configuration option ``image\_processing`` has been removed without
+replacement.
+
+The processor specific configuration option ``colorspace`` has been namespaced
+below the ``processor\_`` hierarchy.
+
+
+Impact
+======
+
+Existing settings in ``LocalConfiguration.php`` are automatically migrated
+through a silent upgrader when entering the Install Tool. If you modify
+the settings in ``AdditionalConfiguration.php`` or rely on them inside an
+extension you need to update those.
+
+
+Affected Installations
+======================
+
+Installations which modify those settings directly or access them.
+
+
+Migration
+=========
+
+The following table lists the changed configuration keys and the appropriate
+values if these have changed.
+
+============================   ===============================================
+Old name                       New name
+============================   ===============================================
+im\_version\_5                 processor
+                               The configuration value "im6" has been replaced
+                               by "ImageMagick", "gm" by "GraphicsMagick"
+im                             processor\_enabled
+im\_v5effects                  processor\_effects
+im\_noScaleUp                  processor\_allowUpscaling
+im\_noFramePrepended           processor\_allowFrameSelection
+im\_mask\_temp\_ext\_gif       processor\_allowTemporaryMasksAsPng
+im\_path                       processor\_path
+imß_path\_lzw                  processor\_path\_lzw
+im\_stripProfileCommand        processor\_stripColorProfileCommand
+im\_useStripProfileByDefault   processor\_stripColorProfileByDefault
+colorspace                     processor\_colorspace
+============================   ===============================================
index ee905f8..541cfba 100644 (file)
@@ -5192,7 +5192,7 @@ class ContentObjectRenderer
                     ? $this->stdWrap($fileArray['crop'], $fileArray['crop.'])
                     : (isset($fileArray['crop']) ? $fileArray['crop'] : null);
                 // Possibility to cancel/force profile extraction
-                // see $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_stripProfileCommand']
+                // see $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripColorProfileCommand']
                 if (isset($fileArray['stripProfile'])) {
                     $processingConfiguration['stripProfile'] = $fileArray['stripProfile'];
                 }
index cf845bf..2330b4b 100644 (file)
@@ -102,8 +102,8 @@ class PageGenerator
         $tsfe->compensateFieldWidth = '' . $tsfe->config['config']['compensateFieldWidth'];
         $tsfe->lockFilePath = '' . $tsfe->config['config']['lockFilePath'];
         $tsfe->lockFilePath = $tsfe->lockFilePath ?: $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
-        $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($tsfe->config['config']['noScaleUp']) ? '' . $tsfe->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
-        $tsfe->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
+        $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowUpscaling'] = (bool)(isset($tsfe->config['config']['processor_allowUpscaling']) ? $tsfe->config['config']['processor_allowUpscaling'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowUpscaling']);
+        $tsfe->TYPO3_CONF_VARS['GFX']['processor_allowUpscaling'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowUpscaling'];
         $tsfe->ATagParams = trim($tsfe->config['config']['ATagParams']) ? ' ' . trim($tsfe->config['config']['ATagParams']) : '';
         if ($tsfe->config['config']['setJS_mouseOver']) {
             $tsfe->setJS('mouseOver');
index 16f7cb3..5ae241e 100644 (file)
@@ -53,7 +53,7 @@ abstract class AbstractImagePreset extends Configuration\AbstractPreset
 
     /**
      * Check is preset is currently active on the system.
-     * Overwrites parent method to ignore im_path and im_path_lzw settings
+     * Overwrites parent method to ignore processor_path and processor_path_lzw settings
      *
      * @return bool TRUE if preset is active
      */
@@ -61,8 +61,8 @@ abstract class AbstractImagePreset extends Configuration\AbstractPreset
     {
         $isActive = true;
         foreach ($this->configurationValues as $configurationKey => $configurationValue) {
-            if ($configurationKey !== 'GFX/im_path'
-                && $configurationKey !== 'GFX/im_path_lzw'
+            if ($configurationKey !== 'GFX/processor_path'
+                && $configurationKey !== 'GFX/processor_path_lzw'
             ) {
                 $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
                 if ($currentValue !== $configurationValue) {
@@ -94,8 +94,8 @@ abstract class AbstractImagePreset extends Configuration\AbstractPreset
     {
         $this->findExecutableInPath($this->getSearchPaths());
         $configurationValues = $this->configurationValues;
-        $configurationValues['GFX/im_path'] = $this->getFoundPath();
-        $configurationValues['GFX/im_path_lzw'] = $this->getFoundPath();
+        $configurationValues['GFX/processor_path'] = $this->getFoundPath();
+        $configurationValues['GFX/processor_path_lzw'] = $this->getFoundPath();
         return $configurationValues;
     }
 
@@ -116,15 +116,15 @@ abstract class AbstractImagePreset extends Configuration\AbstractPreset
     {
         $searchPaths = $this->defaultExecutableSearchPaths;
 
-        // Add configured im_path on top
-        $imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'];
+        // Add configured processor_path on top
+        $imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path'];
         if ((string)$imPath !== '' && !in_array($imPath, $searchPaths)) {
             $path = $this->cleanUpPath($imPath);
             array_unshift($searchPaths, $path);
         }
 
-        // Add configured im_path_lzw on top
-        $imLzwSearchPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'];
+        // Add configured processor_path_lzw on top
+        $imLzwSearchPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw'];
         if ((string)$imLzwSearchPath !== '' && !in_array($imLzwSearchPath, $searchPaths)) {
             $path = $this->cleanUpPath($imLzwSearchPath);
             array_unshift($searchPaths, $path);
index 2144aa0..62acb99 100644 (file)
@@ -25,13 +25,12 @@ class CustomPreset extends Configuration\AbstractCustomPreset implements Configu
      * @var array Configuration values handled by this preset
      */
     protected $configurationValues = array(
-        'GFX/image_processing' => 0,
-        'GFX/im' => 0,
-        'GFX/im_path' => '',
-        'GFX/im_path_lzw' => '',
-        'GFX/im_version_5' => '',
-        'GFX/im_v5effects' => 0,
-        'GFX/im_mask_temp_ext_gif' => 0,
-        'GFX/colorspace' => '',
+        'GFX/processor_enabled' => false,
+        'GFX/processor_path' => '',
+        'GFX/processor_path_lzw' => '',
+        'GFX/processor' => '',
+        'GFX/processor_effects' => 0,
+        'GFX/processor_allowTemporaryMasksAsPng' => true,
+        'GFX/processor_colorspace' => '',
     );
 }
index 2568855..fdd59ad 100644 (file)
@@ -35,15 +35,14 @@ class GraphicsMagickPreset extends AbstractImagePreset implements Configuration\
      * @var array Configuration values handled by this preset
      */
     protected $configurationValues = array(
-        'GFX/image_processing' => 1,
-        'GFX/im' => 1,
-        // im_path and im_path_lzw are determined and set by path lookup methods
-        'GFX/im_path' => '',
-        'GFX/im_path_lzw' => '',
-        'GFX/im_version_5' => 'gm',
-        'GFX/im_v5effects' => -1,
-        'GFX/im_mask_temp_ext_gif' => 1,
-        'GFX/colorspace' => 'RGB',
+        'GFX/processor_enabled' => true,
+        // processor_path and processor_path_lzw are determined and set by path lookup methods
+        'GFX/processor_path' => '',
+        'GFX/processor_path_lzw' => '',
+        'GFX/processor' => 'GraphicsMagick',
+        'GFX/processor_effects' => -1,
+        'GFX/processor_allowTemporaryMasksAsPng' => false,
+        'GFX/processor_colorspace' => 'RGB',
     );
 
     /**
index 2dbd413..cd8ea18 100644 (file)
@@ -35,15 +35,14 @@ class ImageMagick6Preset extends AbstractImagePreset implements Configuration\Pr
      * @var array Configuration values handled by this preset
      */
     protected $configurationValues = array(
-        'GFX/image_processing' => 1,
-        'GFX/im' => 1,
-        // im_path and im_path_lzw are determined and set by path lookup methods
-        'GFX/im_path' => '',
-        'GFX/im_path_lzw' => '',
-        'GFX/im_version_5' => 'im6',
-        'GFX/im_v5effects' => 1,
-        'GFX/im_mask_temp_ext_gif' => 1,
-        'GFX/colorspace' => 'sRGB',
+        'GFX/processor_enabled' => true,
+        // processor_path and processor_path_lzw are determined and set by path lookup methods
+        'GFX/processor_path' => '',
+        'GFX/processor_path_lzw' => '',
+        'GFX/processor' => 'ImageMagick',
+        'GFX/processor_effects' => 1,
+        'GFX/processor_allowTemporaryMasksAsPng' => false,
+        'GFX/processor_colorspace' => 'sRGB',
     );
 
     /**
index 2ca6415..bd1befb 100644 (file)
@@ -570,7 +570,7 @@ class TestSetup extends Action\AbstractAction
             $message->setMessage(
                 'This test makes sense only if the above test had a correct output. But if so, you may not see'
                 . ' a soft dropshadow from the third text string as you should. In that case you are most likely'
-                . ' using ImageMagick 5 and should set the flag TYPO3_CONF_VARS[GFX][im_v5effects].'
+                . ' using ImageMagick 5 and should set the flag TYPO3_CONF_VARS[GFX][processor_effects].'
             );
             $testResults['shadow']['message'] = $message;
         } else {
@@ -623,7 +623,7 @@ class TestSetup extends Action\AbstractAction
         $message->setMessage(
             'ImageMagick / GraphicsMagick handling is enabled, but the execute'
             . ' command returned an error. Please check your settings, especially'
-            . ' [\'GFX\'][\'im_path\'] and [\'GFX\'][\'im_path_lzw\'] and ensure Ghostscript is installed on your server.'
+            . ' [\'GFX\'][\'processor_path\'] and [\'GFX\'][\'processor_path_lzw\'] and ensure Ghostscript is installed on your server.'
         );
         return $message;
     }
@@ -636,11 +636,11 @@ class TestSetup extends Action\AbstractAction
     protected function getImageConfiguration()
     {
         $result = array();
-        $result['imageMagickOrGraphicsMagick'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] === 'gm' ? 'gm' : 'im';
-        $result['imageMagickEnabled'] =  $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'];
-        $result['imageMagickPath'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'];
-        $result['imageMagickVersion'] = $this->determineImageMagickVersion();
-        $result['imageMagick5Effects'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_v5effects'];
+        $result['processor'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor'] === 'GraphicsMagick' ? 'GraphicsMagick' : 'ImageMagick';
+        $result['processorEnabled'] =  $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'];
+        $result['processorPath'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path'];
+        $result['processorVersion'] = $this->determineImageMagickVersion();
+        $result['processorEffects'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_effects'];
         $result['gdlibEnabled'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'];
         $result['gdlibPng'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'];
         $result['fileFormats'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
@@ -662,7 +662,7 @@ class TestSetup extends Action\AbstractAction
         $imageProcessor->filenamePrefix = 'installTool-';
         $imageProcessor->dontCompress = 1;
         $imageProcessor->alternativeOutputKey = 'typo3InstallTest';
-        $imageProcessor->noFramePrepended = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noFramePrepended'];
+        $imageProcessor->noFramePrepended = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_allowFrameSelection'];
         return $imageProcessor;
     }
 
@@ -673,8 +673,8 @@ class TestSetup extends Action\AbstractAction
      */
     protected function isImageMagickEnabledAndConfigured()
     {
-        $enabled = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'];
-        $path = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'];
+        $enabled = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'];
+        $path = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path'];
         return $enabled && $path;
     }
 
index d68a0cb..37ad9d3 100755 (executable)
@@ -88,6 +88,8 @@ class SilentConfigurationUpgradeService
         // #72616
         'BE/XCLASS',
         'FE/XCLASS',
+        // #43085
+        'GFX/image_processing',
     );
 
     /**
@@ -118,8 +120,8 @@ class SilentConfigurationUpgradeService
         $this->configureBackendLoginSecurity();
         $this->configureSaltedPasswords();
         $this->setProxyAuthScheme();
+        $this->migrateImageProcessorSetting();
         $this->transferDeprecatedCurlSettings();
-        $this->disableImageMagickAndGdlibIfImageProcessingIsDisabled();
         $this->disableImageMagickDetailSettingsIfImageMagickIsDisabled();
         $this->setImageMagickDetailSettings();
         $this->removeObsoleteLocalConfigurationSettings();
@@ -316,48 +318,6 @@ class SilentConfigurationUpgradeService
     }
 
     /**
-     * GFX/im and GFX/gdlib must be set to 0 if image_processing is disabled.
-     *
-     * "Configuration presets" in install tool is not type safe, so value
-     * comparisons here are not type safe too, to not trigger changes to
-     * LocalConfiguration again.
-     *
-     * @return void
-     */
-    protected function disableImageMagickAndGdlibIfImageProcessingIsDisabled()
-    {
-        $changedValues = array();
-        try {
-            $currentImageProcessingValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/image_processing');
-        } catch (\RuntimeException $e) {
-            $currentImageProcessingValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/image_processing');
-        }
-        try {
-            $currentImValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im');
-        } catch (\RuntimeException $e) {
-            $currentImValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im');
-        }
-        try {
-            $currentGdlibValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/gdlib');
-        } catch (\RuntimeException $e) {
-            $currentGdlibValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/gdlib');
-        }
-        // If image processing is fully disabled, im and gdlib sub settings must be 0
-        if (!$currentImageProcessingValue) {
-            if ($currentImValue != 0) {
-                $changedValues['GFX/im'] = 0;
-            }
-            if ($currentGdlibValue != 0) {
-                $changedValues['GFX/gdlib'] = 0;
-            }
-        }
-        if (!empty($changedValues)) {
-            $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($changedValues);
-            $this->throwRedirectException();
-        }
-    }
-
-    /**
      * Detail configuration of Image Magick settings must be cleared
      * if Image Magick handling is disabled.
      *
@@ -371,36 +331,41 @@ class SilentConfigurationUpgradeService
     {
         $changedValues = array();
         try {
-            $currentImValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im');
+            $currentImValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_enabled');
         } catch (\RuntimeException $e) {
-            $currentImValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im');
+            $currentImValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_enabled');
         }
+
         try {
-            $currentImPathValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_path');
+            $currentImPathValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_path');
         } catch (\RuntimeException $e) {
-            $currentImPathValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_path');
+            $currentImPathValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_path');
         }
+
         try {
-            $currentImPathLzwValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_path_lzw');
+            $currentImPathLzwValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_path_lzw');
         } catch (\RuntimeException $e) {
-            $currentImPathLzwValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_path_lzw');
+            $currentImPathLzwValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_path_lzw');
         }
+
         try {
             $currentImageFileExtValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/imagefile_ext');
         } catch (\RuntimeException $e) {
             $currentImageFileExtValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/imagefile_ext');
         }
+
         try {
             $currentThumbnailsValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/thumbnails');
         } catch (\RuntimeException $e) {
             $currentThumbnailsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/thumbnails');
         }
+
         if (!$currentImValue) {
             if ($currentImPathValue != '') {
-                $changedValues['GFX/im_path'] = '';
+                $changedValues['GFX/processor_path'] = '';
             }
             if ($currentImPathLzwValue != '') {
-                $changedValues['GFX/im_path_lzw'] = '';
+                $changedValues['GFX/processor_path_lzw'] = '';
             }
             if ($currentImageFileExtValue !== 'gif,jpg,jpeg,png') {
                 $changedValues['GFX/imagefile_ext'] = 'gif,jpg,jpeg,png';
@@ -429,27 +394,30 @@ class SilentConfigurationUpgradeService
     {
         $changedValues = array();
         try {
-            $currentIm5Value = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_version_5');
+            $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor');
         } catch (\RuntimeException $e) {
-            $currentIm5Value = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_version_5');
+            $currentProcessorValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor');
         }
+
         try {
-            $currentImMaskValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_mask_temp_ext_gif');
+            $currentProcessorMaskValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng');
         } catch (\RuntimeException $e) {
-            $currentImMaskValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_mask_temp_ext_gif');
+            $currentProcessorMaskValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng');
         }
+
         try {
-            $currentIm5EffectsValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_v5effects');
+            $currentProcessorEffectsValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_effects');
         } catch (\RuntimeException $e) {
-            $currentIm5EffectsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_v5effects');
+            $currentProcessorEffectsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_effects');
         }
-        if ((string)$currentIm5Value !== '') {
-            if ($currentImMaskValue != 1) {
-                $changedValues['GFX/im_mask_temp_ext_gif'] = 1;
+
+        if ((string)$currentProcessorValue !== '') {
+            if ($currentProcessorMaskValue != 0) {
+                $changedValues['GFX/processor_allowTemporaryMasksAsPng'] = 0;
             }
-            if ($currentIm5Value === 'gm') {
-                if ($currentIm5EffectsValue != -1) {
-                    $changedValues['GFX/im_v5effects'] = -1;
+            if ($currentProcessorValue === 'GraphicsMagick') {
+                if ($currentProcessorEffectsValue != -1) {
+                    $changedValues['GFX/processor_effects'] = -1;
                 }
             }
         }
@@ -460,6 +428,70 @@ class SilentConfigurationUpgradeService
     }
 
     /**
+     * Migrate the definition of the image processor from the configuration value
+     * im_version_5 to the setting processor.
+     *
+     * @return void
+     */
+    protected function migrateImageProcessorSetting()
+    {
+        $changedSettings = array();
+        $settingsToRename = array(
+            'GFX/im' => 'GFX/processor_enabled',
+            'GFX/im_version_5' => 'GFX/processor',
+            'GFX/im_v5effects' => 'GFX/processor_effects',
+            'GFX/im_path' => 'GFX/processor_path',
+            'GFX/im_path_lzw' => 'GFX/processor_path_lzw',
+            'GFX/im_mask_temp_ext_gif' => 'GFX/processor_allowTemporaryMasksAsPng',
+            'GFX/im_noScaleUp' => 'GFX/processor_allowUpscaling',
+            'GFX/im_noFramePrepended' => 'GFX/processor_allowFrameSelection',
+            'GFX/im_stripProfileCommand' => 'GFX/processor_stripColorProfileCommand',
+            'GFX/im_useStripProfileByDefault' => 'GFX/processor_stripColorProfileByDefault',
+            'GFX/colorspace' => 'GFX/processor_colorspace',
+        );
+
+        foreach ($settingsToRename as $oldPath => $newPath) {
+            try {
+                $value = $this->configurationManager->getLocalConfigurationValueByPath($oldPath);
+                $this->configurationManager->setLocalConfigurationValueByPath($newPath, $value);
+                $changedSettings[$oldPath] = true;
+            } catch (\RuntimeException $e) {
+                // If an exception is thrown, the value is not set in LocalConfiguration
+                $changedSettings[$oldPath] = false;
+            }
+        }
+
+        if (!empty($changedSettings['GFX/im_version_5'])) {
+            $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_version_5');
+            $newProcessorValue = $currentProcessorValue === 'gm' ? 'GraphicsMagick' : 'ImageMagick';
+            $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor', $newProcessorValue);
+        }
+
+        if (!empty($changedSettings['GFX/im_noScaleUp'])) {
+            $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_noScaleUp');
+            $newProcessorValue = !$currentProcessorValue;
+            $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor_allowUpscaling', $newProcessorValue);
+        }
+
+        if (!empty($changedSettings['GFX/im_noFramePrepended'])) {
+            $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_noFramePrepended');
+            $newProcessorValue = !$currentProcessorValue;
+            $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor_allowFrameSelection', $newProcessorValue);
+        }
+
+        if (!empty($changedSettings['GFX/im_mask_temp_ext_gif'])) {
+            $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_mask_temp_ext_gif');
+            $newProcessorValue = !$currentProcessorValue;
+            $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng', $newProcessorValue);
+        }
+
+        if (!empty(array_filter($changedSettings))) {
+            $this->configurationManager->removeLocalConfigurationKeysByPath(array_keys($changedSettings));
+            $this->throwRedirectException();
+        }
+    }
+
+    /**
      * Throw exception after configuration change to trigger a redirect.
      *
      * @throws RedirectException
index 2293760..d896a2d 100644 (file)
@@ -29,7 +29,7 @@
                function in PHP. TYPO3 uses three of these, namely 'convert' (converting fileformats,
                scaling, effects), 'combine'/'composite' (combining images with masks) and 'identify'
                (returns image information). GraphicsMagick is an alternative to ImageMagick and can
-               be enabled by setting [GFX][im_version_5] to 'gm'. This is recommended and enabled
+               be enabled by setting [GFX][processor] to 'GraphicsMagick'. This is recommended and enabled
                by default. Because ImageMagick and Graphicsmagick are external programs, a requirement
                must be met: The programs must be installed on the server and working. ImageMagick is
                available for both Windows and Unix. The current version is 6+. ImageMagick homepage is
@@ -48,8 +48,4 @@
                with GDLib compiled in. Also in order to use TrueType fonts with GDLib you'll
                need FreeType compiled in as well.
        </p>
-       <p>
-               You can disable all image processing options in TYPO3 ([GFX][image_processing]=0),
-               but that would seriously disable TYPO3.
-       </p>
 </div>
index 1353b61..26f9c2c 100644 (file)
@@ -5,10 +5,10 @@
        <table class="table table-striped">
                <tr>
                        <td>
-                               {f:if(condition:'{imageConfiguration.imageMagickOrGraphicsMagick} == \'im\'', then:'ImageMagick', else:'GrapicsMagick')} enabled:
+                               {imageConfiguration.processor} enabled:
                        </td>
                        <td>
-                               {f:if(condition:imageConfiguration.imageMagickEnabled, then:'Yes', else:'No')}
+                               {f:if(condition:imageConfiguration.processorEnabled, then:'Yes', else:'No')}
                        </td>
                </tr>
                <tr>
                                ImageMagick or GraphicsMagick:
                        </td>
                        <td>
-                               {f:if(condition:'{imageConfiguration.imageMagickOrGraphicsMagick} == \'im\'', then:'ImageMagick', else:'GrapicsMagick')}
+                               {imageConfiguration.processor}
                        </td>
                </tr>
                <tr>
                        <td>
-                               {f:if(condition:'{imageConfiguration.imageMagickOrGraphicsMagick} == \'im\'', then:'ImageMagick', else:'GrapicsMagick')} path:
+                               {imageConfiguration.processor} path:
                        </td>
                        <td>
-                               {imageConfiguration.imageMagickPath}
+                               {imageConfiguration.processorPath}
                        </td>
                </tr>
                <tr>
                        <td>
-                               {f:if(condition:'{imageConfiguration.imageMagickOrGraphicsMagick} == \'im\'', then:'ImageMagick', else:'GrapicsMagick')} version:
+                               {imageConfiguration.processor} version:
                        </td>
                        <td>
-                               {imageConfiguration.imageMagickVersion}
+                               {imageConfiguration.processorVersion}
                        </td>
                </tr>
                <tr>
                        <td>
-                               IM5 effects enabled:
+                               {imageConfiguration.processor} effects enabled:
                        </td>
                        <td>
-                               {imageConfiguration.imageMagick5Effects} <span>(Blurring/Sharpening with IM 5+)</span>
+                               {imageConfiguration.processorEffects} <span>(Blurring/Sharpening with {imageConfiguration.processor})</span>
                        </td>
                </tr>
                <tr>
index 408ca27..d0feeb6 100644 (file)
@@ -5,12 +5,12 @@ These comparison images was generated by Kasper Skårhøj, using:
 - Image Magick 5.5.7 / FreeType 2 / PHP4
 
 - This localconf.php configuration:
-$TYPO3_CONF_VARS['GFX']['im_path_lzw'] = '';
+$TYPO3_CONF_VARS['GFX']['processor_path_lzw'] = '';
 $TYPO3_CONF_VARS['GFX']['TTFdpi'] = '96';
 $TYPO3_CONF_VARS['GFX']['gdlib_png'] = '1';
-$TYPO3_CONF_VARS['GFX']['im_path'] = '/usr/bin/';
-$TYPO3_CONF_VARS['GFX']['im_version_5'] = 'im5';
-$TYPO3_CONF_VARS['GFX']['im_v5effects'] = '1';
+$TYPO3_CONF_VARS['GFX']['processor_path'] = '/usr/bin/';
+$TYPO3_CONF_VARS['GFX']['processor'] = 'im5';
+$TYPO3_CONF_VARS['GFX']['processor_effects'] = '1';
 $TYPO3_CONF_VARS['GFX']['gdlib_2'] = 1;
 
 - PHP / GD configuration:
@@ -27,4 +27,4 @@ WBMP Support          enabled
 
 - I was not able to create GIF files for reference so I just converted them directly with ImageMagick
 
-- Also LZW compression has NOT been used anywhere except the GD test images since ImageMagick doesn't support it.
\ No newline at end of file
+- Also LZW compression has NOT been used anywhere except the GD test images since ImageMagick doesn't support it.
index c62224b..9483035 100644 (file)
@@ -655,189 +655,6 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
     /**
      * @test
      */
-    public function disableImageMagickIfImageProcessingIsDisabled()
-    {
-        /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
-        $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(
-            SilentConfigurationUpgradeService::class,
-            array('dummy'),
-            array(),
-            '',
-            false
-        );
-
-        $currentLocalConfiguration = array(
-            array('GFX/image_processing', 0),
-            array('GFX/im', 1),
-            array('GFX/gdlib', 0)
-        );
-        $this->createConfigurationManagerWithMockedMethods(
-            array(
-                'getLocalConfigurationValueByPath',
-                'getDefaultConfigurationValueByPath',
-                'setLocalConfigurationValuesByPathValuePairs',
-            )
-        );
-        $this->configurationManager->expects($this->exactly(3))
-            ->method('getLocalConfigurationValueByPath')
-            ->will($this->returnValueMap($currentLocalConfiguration));
-        $this->configurationManager->expects($this->never())
-            ->method('getDefaultConfigurationValueByPath');
-        $this->configurationManager->expects($this->once())
-            ->method('setLocalConfigurationValuesByPathValuePairs')
-            ->withConsecutive(
-                array(array('GFX/im' => 0))
-            );
-
-        $this->setExpectedException(\TYPO3\CMS\Install\Controller\Exception\RedirectException::class);
-
-        $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
-
-        $silentConfigurationUpgradeServiceInstance->_call('disableImageMagickAndGdlibIfImageProcessingIsDisabled');
-    }
-
-    /**
-     * @test
-     */
-    public function disableGdlibIfImageProcessingIsDisabled()
-    {
-        /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
-        $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(
-            SilentConfigurationUpgradeService::class,
-            array('dummy'),
-            array(),
-            '',
-            false
-        );
-
-        $currentLocalConfiguration = array(
-            array('GFX/image_processing', 0),
-            array('GFX/im', 0),
-            array('GFX/gdlib', 1)
-        );
-        $this->createConfigurationManagerWithMockedMethods(
-            array(
-                'getLocalConfigurationValueByPath',
-                'getDefaultConfigurationValueByPath',
-                'setLocalConfigurationValuesByPathValuePairs',
-            )
-        );
-        $this->configurationManager->expects($this->exactly(3))
-            ->method('getLocalConfigurationValueByPath')
-            ->will($this->returnValueMap($currentLocalConfiguration));
-        $this->configurationManager->expects($this->never())
-            ->method('getDefaultConfigurationValueByPath');
-        $this->configurationManager->expects($this->once())
-            ->method('setLocalConfigurationValuesByPathValuePairs')
-            ->withConsecutive(
-                array(array('GFX/gdlib' => 0))
-            );
-
-        $this->setExpectedException(\TYPO3\CMS\Install\Controller\Exception\RedirectException::class);
-
-        $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
-
-        $silentConfigurationUpgradeServiceInstance->_call('disableImageMagickAndGdlibIfImageProcessingIsDisabled');
-    }
-
-    /**
-     * @test
-     */
-    public function doNotDisableImageMagickAndGdlibIfImageProcessingIsEnabled()
-    {
-        /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
-        $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(
-            SilentConfigurationUpgradeService::class,
-            array('dummy'),
-            array(),
-            '',
-            false
-        );
-
-        $currentLocalConfiguration = array(
-            array('GFX/image_processing', 1),
-            array('GFX/im', 1),
-            array('GFX/gdlib', 1)
-        );
-        $this->createConfigurationManagerWithMockedMethods(
-            array(
-                'getLocalConfigurationValueByPath',
-                'getDefaultConfigurationValueByPath',
-                'setLocalConfigurationValuesByPathValuePairs',
-            )
-        );
-        $this->configurationManager->expects($this->exactly(3))
-            ->method('getLocalConfigurationValueByPath')
-            ->will($this->returnValueMap($currentLocalConfiguration));
-        $this->configurationManager->expects($this->never())
-            ->method('getDefaultConfigurationValueByPath');
-        $this->configurationManager->expects($this->never())
-            ->method('setLocalConfigurationValuesByPathValuePairs');
-
-        $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
-
-        $silentConfigurationUpgradeServiceInstance->_call('disableImageMagickAndGdlibIfImageProcessingIsDisabled');
-    }
-
-    /**
-     * @test
-     */
-    public function disableImageMagickIfDefaultImageProcessingIsDisabled()
-    {
-        /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
-        $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(
-            SilentConfigurationUpgradeService::class,
-            array('dummy'),
-            array(),
-            '',
-            false
-        );
-
-        $currentDefaultConfiguration = array(
-            array('GFX/image_processing', 0),
-        );
-        $closure = function ($param) {
-            switch ($param) {
-                case 'GFX/im':
-                    return '1';
-                    break;
-                case 'GFX/gdlib':
-                    return '0';
-                    break;
-                default:
-                    throw new \RuntimeException('Path does not exist in array', 1341397869);
-            }
-        };
-
-        $this->createConfigurationManagerWithMockedMethods(
-            array(
-                'getLocalConfigurationValueByPath',
-                'getDefaultConfigurationValueByPath',
-                'setLocalConfigurationValuesByPathValuePairs',
-            )
-        );
-        $this->configurationManager->expects($this->exactly(3))
-            ->method('getLocalConfigurationValueByPath')
-            ->will($this->returnCallback($closure));
-        $this->configurationManager->expects($this->exactly(1))
-            ->method('getDefaultConfigurationValueByPath')
-            ->will($this->returnValueMap($currentDefaultConfiguration));
-        $this->configurationManager->expects($this->once())
-            ->method('setLocalConfigurationValuesByPathValuePairs')
-            ->withConsecutive(
-                array(array('GFX/im' => 0))
-            );
-
-        $this->setExpectedException(RedirectException::class);
-
-        $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
-
-        $silentConfigurationUpgradeServiceInstance->_call('disableImageMagickAndGdlibIfImageProcessingIsDisabled');
-    }
-
-    /**
-     * @test
-     */
     public function disableImageMagickDetailSettingsIfImageMagickIsDisabled()
     {
         /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
@@ -937,9 +754,9 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
         );
 
         $currentLocalConfiguration = array(
-            array('GFX/im_version_5', 'gm'),
-            array('GFX/im_mask_temp_ext_gif', 0),
-            array('GFX/im_v5effects', 0)
+            array('GFX/processor', 'GraphicsMagick'),
+            array('GFX/processor_allowTemporaryMasksAsPng', 1),
+            array('GFX/processor_effects', 0)
         );
         $this->createConfigurationManagerWithMockedMethods(
             array(
@@ -956,8 +773,8 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
         $this->configurationManager->expects($this->once())
             ->method('setLocalConfigurationValuesByPathValuePairs')
             ->withConsecutive(
-                array(array('GFX/im_mask_temp_ext_gif' => 1,
-                            'GFX/im_v5effects' => -1))
+                array(array('GFX/processor_allowTemporaryMasksAsPng' => 0,
+                            'GFX/processor_effects' => -1))
             );
 
         $this->setExpectedException(RedirectException::class);
@@ -982,9 +799,9 @@ class SilentConfigurationUpgradeServiceTest extends \TYPO3\CMS\Core\Tests\UnitTe
         );
 
         $currentLocalConfiguration = array(
-            array('GFX/im_version_5', ''),
-            array('GFX/im_mask_temp_ext_gif', 0),
-            array('GFX/im_v5effects', 0)
+            array('GFX/processor', ''),
+            array('GFX/processor_allowTemporaryMasksAsPng', 0),
+            array('GFX/processor_effects', 0)
         );
         $this->createConfigurationManagerWithMockedMethods(
             array(
index 37d1bc1..7989e92 100644 (file)
@@ -635,7 +635,7 @@ This is especially useful if you want to add RDFa or microformats to your html.
 Please take note that this tag is required for XHTML compliant output, so you should only disable this tag if you generate it manually already.]]></description>
                        <default><![CDATA[0]]></default>
                </property>
-               <property name="noScaleUp" type="boolean">
+               <property name="processor_allowUpscaling" type="boolean">
                        <description><![CDATA[Normally images are scaled to the size specified via TypoScript. This also forces small images to be scaled to a larger size. This is not always a good thing.
 If this property is set, images are not allowed to be scaled up in size. This parameter clears the $this->mayScaleUp var of the class \TYPO3\CMS\Core\Imaging\GraphicalFunctions (often "gifbuilder").]]></description>
                        <default><![CDATA[
@@ -6433,7 +6433,7 @@ fx. "-rotate 90" or "-negate"]]></description>
                <property name="stripProfile" type="boolean">
                        <description><![CDATA[If set, IM-command will use a stripProfile-command which shrinks the generated thumbnails. See Install Tool for options and details.
 
-If im_useStripProfileByDefault is set in the install tool, you can deactivate it by setting stripProfile=0.
+If processor_stripColorProfileByDefault is set in the install tool, you can deactivate it by setting stripProfile=0.
 
 Example:
 
index 4766461..3a0cabc 100644 (file)
@@ -613,7 +613,7 @@ var typoscriptWords = {
        'noOrderBy': 'reserved',
        'noPageTitle': 'reserved',
        'noRows': 'reserved',
-       'noScaleUp': 'reserved',
+       'processor_allowUpscaling': 'reserved',
        'noStretchAndMarginCells': 'reserved',
        'noThumbsInEB': 'reserved',
        'noThumbsInRTEimageSelect': 'reserved',
@@ -1920,7 +1920,7 @@ var typoscriptWords = {
        'noOrderBy': 'reserved',
        'noPageTitle': 'reserved',
        'noRows': 'reserved',
-       'noScaleUp': 'reserved',
+       'processor_allowUpscaling': 'reserved',
        'noStretchAndMarginCells': 'reserved',
        'noThumbsInEB': 'reserved',
        'noThumbsInRTEimageSelect': 'reserved',