You are here

protected function ImagemagickExecManager::getExecutable in ImageMagick 8.3

Same name and namespace in other branches
  1. 8.2 src/ImagemagickExecManager.php \Drupal\imagemagick\ImagemagickExecManager::getExecutable()

Returns the full path to the executable.

Parameters

string $binary: The program to execute, typically 'convert', 'identify' or 'gm'.

string $path: (optional) A custom path to the folder of the executable. When left empty, the setting imagemagick.settings.path_to_binaries is taken.

Return value

string The full path to the executable.

2 calls to ImagemagickExecManager::getExecutable()
ImagemagickExecManager::checkPath in src/ImagemagickExecManager.php
Verifies file path of the executable binary by checking its version.
ImagemagickExecManager::execute in src/ImagemagickExecManager.php
Executes the convert executable as shell command.

File

src/ImagemagickExecManager.php, line 428

Class

ImagemagickExecManager
Manage execution of ImageMagick/GraphicsMagick commands.

Namespace

Drupal\imagemagick

Code

protected function getExecutable(string $binary, string $path = NULL) : string {

  // $path is only passed from the validation of the image toolkit form, on
  // which the path to convert is configured. @see ::checkPath()
  if (!isset($path)) {
    $path = $this->configFactory
      ->get('imagemagick.settings')
      ->get('path_to_binaries');
  }
  $executable = $binary;
  if ($this->isWindows) {
    $executable .= '.exe';
  }
  return $path . $executable;
}