You are here

public function ImagemagickToolkit::getExecutable in ImageMagick 8

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 ImagemagickToolkit::getExecutable()
ImagemagickToolkit::checkPath in src/Plugin/ImageToolkit/ImagemagickToolkit.php
Verifies file path of the executable binary by checking its version.
ImagemagickToolkit::imagemagickExec in src/Plugin/ImageToolkit/ImagemagickToolkit.php
Executes the convert executable as shell command.

File

src/Plugin/ImageToolkit/ImagemagickToolkit.php, line 1366

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

public function getExecutable($binary, $path = NULL) {

  // $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;
}