public function ImagemagickExecArguments::add in ImageMagick 8.3
Same name and namespace in other branches
- 8.2 src/ImagemagickExecArguments.php \Drupal\imagemagick\ImagemagickExecArguments::add()
Adds a command line argument.
Parameters
string $argument: The command line argument to be added.
int $mode: (optional) The mode of the argument in the command line. Determines if the argument should be placed before or after the source image file path. Defaults to self::POST_SOURCE.
int $index: (optional) The position of the argument in the arguments array. Reflects the sequence of arguments in the command line. Defaults to self::APPEND.
array $info: (optional) An optional array with information about the argument. Defaults to an empty array.
Return value
$this
File
- src/
ImagemagickExecArguments.php, line 145
Class
- ImagemagickExecArguments
- Stores arguments for execution of ImageMagick/GraphicsMagick commands.
Namespace
Drupal\imagemagickCode
public function add(string $argument, int $mode = self::POST_SOURCE, int $index = self::APPEND, array $info = []) : ImagemagickExecArguments {
$argument = [
'argument' => $argument,
'mode' => $mode,
'info' => $info,
];
if ($index === self::APPEND) {
$this->arguments[] = $argument;
}
elseif ($index === 0) {
array_unshift($this->arguments, $argument);
}
else {
array_splice($this->arguments, $index, 0, [
$argument,
]);
}
return $this;
}