true, // processor_path is determined and set by path lookup methods 'GFX/processor_path' => '', 'GFX/processor' => 'GraphicsMagick', 'GFX/processor_effects' => false, ]; /** * Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods. * * @return mixed */ protected function findExecutableInPath(array $searchPaths) { return $this->findGraphicsMagickInPaths($searchPaths); } /** * Search for GraphicsMagick executables in given paths. * * @param array $searchPaths List of paths to search for * @return bool TRUE if graphics magick was found in path */ protected function findGraphicsMagickInPaths(array $searchPaths) { $result = false; foreach ($searchPaths as $path) { if (Environment::isWindows()) { $executable = 'gm.exe'; } else { $executable = 'gm'; } $binaryPath = $path . $executable; if (!file_exists($binaryPath) || !is_executable($binaryPath)) { continue; } $command = escapeshellarg($binaryPath) . ' -version'; $executingResult = []; @CommandUtility::exec($command, $executingResult); // First line of exec command should contain string GraphicsMagick $firstResultLine = array_shift($executingResult); if (is_string($firstResultLine) && str_contains($firstResultLine, 'GraphicsMagick')) { $this->foundPath = $path; $result = true; break; } } return $result; } }