‪TYPO3CMS  10.4
ImageMagick6Preset.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
26 {
30  protected ‪$name = 'ImageMagick6';
31 
35  protected ‪$priority = 70;
36 
40  protected ‪$configurationValues = [
41  'GFX/processor_enabled' => true,
42  // processor_path and processor_path_lzw are determined and set by path lookup methods
43  'GFX/processor_path' => '',
44  'GFX/processor_path_lzw' => '',
45  'GFX/processor' => 'ImageMagick',
46  'GFX/processor_effects' => true,
47  'GFX/processor_allowTemporaryMasksAsPng' => false,
48  'GFX/processor_colorspace' => 'sRGB',
49  ];
50 
57  protected function ‪findExecutableInPath(array $searchPaths)
58  {
59  return $this->‪findImageMagick6InPaths($searchPaths);
60  }
61 
68  protected function ‪findImageMagick6InPaths(array $searchPaths)
69  {
70  $result = false;
71  foreach ($searchPaths as $path) {
73  $executable = 'identify.exe';
74 
75  if (!@is_file($path . $executable)) {
76  $executable = 'magick.exe';
77  }
78  } else {
79  $executable = 'identify';
80  }
81  if (@is_file($path . $executable)) {
82  $command = escapeshellarg($path . $executable) . ' -version';
83  $executingResult = false;
84  ‪CommandUtility::exec($command, $executingResult);
85  // First line of exec command should contain string GraphicsMagick
86  $firstResultLine = array_shift($executingResult);
87  // Example: "Version: ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org"
88  if (strpos($firstResultLine, 'ImageMagick') !== false) {
89  [, $version] = explode('ImageMagick', $firstResultLine);
90  // Example: "6.6.0-4"
91  [$version] = explode(' ', trim($version));
92  if (version_compare($version, '6.0.0') >= 0) {
93  $this->foundPath = $path;
94  $result = true;
95  break;
96  }
97  }
98  }
99  }
100  return $result;
101  }
102 }
‪TYPO3\CMS\Install\Configuration\Image\ImageMagick6Preset\$configurationValues
‪array $configurationValues
Definition: ImageMagick6Preset.php:37
‪TYPO3\CMS\Install\Configuration\Image\AbstractImagePreset
Definition: AbstractImagePreset.php:27
‪TYPO3\CMS\Install\Configuration\Image\ImageMagick6Preset\findImageMagick6InPaths
‪bool findImageMagick6InPaths(array $searchPaths)
Definition: ImageMagick6Preset.php:65
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:292
‪TYPO3\CMS\Install\Configuration\Image\ImageMagick6Preset
Definition: ImageMagick6Preset.php:26
‪TYPO3\CMS\Install\Configuration\Image\ImageMagick6Preset\$priority
‪int $priority
Definition: ImageMagick6Preset.php:33
‪TYPO3\CMS\Core\Utility\CommandUtility\exec
‪static string exec($command, &$output=null, &$returnValue=0)
Definition: CommandUtility.php:81
‪TYPO3\CMS\Install\Configuration\Image
Definition: AbstractImagePreset.php:16
‪TYPO3\CMS\Install\Configuration\Image\ImageMagick6Preset\findExecutableInPath
‪mixed findExecutableInPath(array $searchPaths)
Definition: ImageMagick6Preset.php:54
‪TYPO3\CMS\Install\Configuration\Image\ImageMagick6Preset\$name
‪string $name
Definition: ImageMagick6Preset.php:29
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:40
‪TYPO3\CMS\Core\Utility\CommandUtility
Definition: CommandUtility.php:49