‪TYPO3CMS  9.5
GraphicsMagickPreset.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
24 {
28  protected ‪$name = 'GraphicsMagick';
29 
33  protected ‪$priority = 80;
34 
38  protected ‪$configurationValues = [
39  'GFX/processor_enabled' => true,
40  // processor_path and processor_path_lzw are determined and set by path lookup methods
41  'GFX/processor_path' => '',
42  'GFX/processor_path_lzw' => '',
43  'GFX/processor' => 'GraphicsMagick',
44  'GFX/processor_effects' => false,
45  'GFX/processor_allowTemporaryMasksAsPng' => false,
46  'GFX/processor_colorspace' => 'RGB',
47  ];
48 
55  protected function ‪findExecutableInPath(array $searchPaths)
56  {
57  return $this->‪findGraphicsMagickInPaths($searchPaths);
58  }
59 
66  protected function ‪findGraphicsMagickInPaths(array $searchPaths)
67  {
68  $result = false;
69  foreach ($searchPaths as $path) {
71  $executable = 'gm.exe';
72  } else {
73  $executable = 'gm';
74  }
75  if (@is_file($path . $executable)) {
76  $command = escapeshellarg($path . $executable) . ' -version';
77  $executingResult = false;
78  ‪\TYPO3\CMS\Core\Utility\CommandUtility::exec($command, $executingResult);
79  // First line of exec command should contain string GraphicsMagick
80  $firstResultLine = array_shift($executingResult);
81  if (strpos($firstResultLine, 'GraphicsMagick') !== false) {
82  $this->foundPath = $path;
83  $result = true;
84  break;
85  }
86  }
87  }
88  return $result;
89  }
90 }
‪TYPO3\CMS\Install\Configuration\Image\AbstractImagePreset
Definition: AbstractImagePreset.php:24
‪TYPO3\CMS\Install\Configuration\Image\GraphicsMagickPreset\$name
‪string $name
Definition: GraphicsMagickPreset.php:27
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:266
‪TYPO3\CMS\Install\Configuration\Image\GraphicsMagickPreset\findExecutableInPath
‪mixed findExecutableInPath(array $searchPaths)
Definition: GraphicsMagickPreset.php:52
‪TYPO3\CMS\Install\Configuration\Image\GraphicsMagickPreset\$configurationValues
‪array $configurationValues
Definition: GraphicsMagickPreset.php:35
‪TYPO3\CMS\Core\Utility\CommandUtility\exec
‪static string exec($command, &$output=null, &$returnValue=0)
Definition: CommandUtility.php:80
‪TYPO3\CMS\Install\Configuration\Image\GraphicsMagickPreset
Definition: GraphicsMagickPreset.php:24
‪TYPO3\CMS\Install\Configuration\Image
Definition: AbstractImagePreset.php:2
‪TYPO3\CMS\Install\Configuration\Image\GraphicsMagickPreset\$priority
‪int $priority
Definition: GraphicsMagickPreset.php:31
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Install\Configuration\Image\GraphicsMagickPreset\findGraphicsMagickInPaths
‪bool findGraphicsMagickInPaths(array $searchPaths)
Definition: GraphicsMagickPreset.php:63