From e16531da5234323e82f76cfbcde31bf64bf05413 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Sat, 25 Mar 2017 22:06:11 +0100 Subject: [PATCH] [TASK] Cleanup legacy IMv4 options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GraphicalFunctions options $V5_EFFECTS and $_NO_IM_EFFECTS are no the exact opposite all times, due to the removal of IM4 support. For this reason, the property $V5_EFFECTS can be removed. Resolves: #80448 Releases: master Change-Id: I935a5d89a98ebc16b04be46e492d26346fa10f82 Reviewed-on: https://review.typo3.org/52159 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Frank Nägler <frank.naegler@typo3.org> Tested-by: Frank Nägler <frank.naegler@typo3.org> --- .../Classes/Imaging/GraphicalFunctions.php | 46 ++++--------------- .../Controller/Action/Tool/TestSetup.php | 2 +- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php index 2b948c72e742..f7d43a72ab08 100644 --- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php +++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php @@ -141,11 +141,6 @@ class GraphicalFunctions */ public $NO_IMAGE_MAGICK = ''; - /** - * @var bool - */ - public $V5_EFFECTS = 0; - /** * @var bool */ @@ -376,10 +371,8 @@ class GraphicalFunctions // ... but if 'processor_effects' is set, enable effects if ($gfxConf['processor_effects']) { $this->NO_IM_EFFECTS = 0; - $this->V5_EFFECTS = 1; - if ($gfxConf['processor_effects'] > 0) { - $this->cmds['jpg'] = $this->cmds['jpeg'] = '-colorspace ' . $this->colorspace . ' -quality ' . $this->jpegQuality . $this->v5_sharpen(10); - } + $this->cmds['jpg'] .= $this->v5_sharpen(10); + $this->cmds['jpeg'] .= $this->v5_sharpen(10); } // Secures that images are not scaled up. if (!$gfxConf['processor_allowUpscaling']) { @@ -682,11 +675,7 @@ class GraphicalFunctions } else { $command = trim($conf['niceText.']['before'] . ' ' . $this->scalecmd . ' ' . $w . 'x' . $h . '! ' . $conf['niceText.']['after'] . ' -negate'); if ($conf['niceText.']['sharpen']) { - if ($this->V5_EFFECTS) { - $command .= $this->v5_sharpen($conf['niceText.']['sharpen']); - } else { - $command .= ' -sharpen ' . MathUtility::forceIntegerInRange($conf['niceText.']['sharpen'], 1, 99); - } + $command .= $this->v5_sharpen($conf['niceText.']['sharpen']); } } $this->imageMagickExec($fileMask, $fileMask, $command); @@ -1491,18 +1480,7 @@ class GraphicalFunctions $this->ImageWrite($blurTextImg, $fileMask); // Destroy imagedestroy($blurTextImg); - $command = ''; - if ($this->V5_EFFECTS) { - $command .= $this->v5_blur($blurRate + 1); - } else { - // Blurring of the mask - // How many blur-commands that is executed. Min = 1; - $times = ceil($blurRate / 10); - // Building blur-command - for ($a = 0; $a < $times; $a++) { - $command .= ' -blur ' . $blurRate; - } - } + $command = $this->v5_blur($blurRate + 1); $this->imageMagickExec($fileMask, $fileMask, $command . ' +matte'); // The mask is loaded again $blurTextImg_tmp = $this->imageCreateFromFile($fileMask); @@ -1661,20 +1639,12 @@ class GraphicalFunctions break; case 'blur': if (!$this->NO_IM_EFFECTS) { - if ($this->V5_EFFECTS) { - $commands .= $this->v5_blur($value); - } else { - $commands .= ' -blur ' . MathUtility::forceIntegerInRange($value, 1, 99); - } + $commands .= $this->v5_blur($value); } break; case 'sharpen': if (!$this->NO_IM_EFFECTS) { - if ($this->V5_EFFECTS) { - $commands .= $this->v5_sharpen($value); - } else { - $commands .= ' -sharpen ' . MathUtility::forceIntegerInRange($value, 1, 99); - } + $commands .= $this->v5_sharpen($value); } break; case 'rotate': @@ -1987,7 +1957,7 @@ class GraphicalFunctions } /** - * Returns the IM command for sharpening with ImageMagick 5 (when $this->V5_EFFECTS is set). + * Returns the IM command for sharpening with ImageMagick 5 * Uses $this->im5fx_sharpenSteps for translation of the factor to an actual command. * * @param int $factor The sharpening factor, 0-100 (effectively in 10 steps) @@ -2006,7 +1976,7 @@ class GraphicalFunctions } /** - * Returns the IM command for blurring with ImageMagick 5 (when $this->V5_EFFECTS is set). + * Returns the IM command for blurring with ImageMagick 5. * Uses $this->im5fx_blurSteps for translation of the factor to an actual command. * * @param int $factor The blurring factor, 0-100 (effectively in 10 steps) diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php b/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php index e7d961f56b15..792c8401a7a2 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php +++ b/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php @@ -549,7 +549,7 @@ class TestSetup extends Action\AbstractAction $conf['niceText'] = 1; $conf['shadow.'] = [ 'offset' => '2,2', - 'blur' => $imageProcessor->V5_EFFECTS ? '20' : '90', + 'blur' => $imageProcessor->NO_IM_EFFECTS ? '90' : '20', 'opacity' => '50', 'color' => 'black' ]; -- GitLab