You are here

function _imageapi_imagemagick_convert in ImageAPI 5

Same name and namespace in other branches
  1. 6 imageapi_imagemagick.module \_imageapi_imagemagick_convert()

Calls the convert executable with the specified filter.

1 call to _imageapi_imagemagick_convert()
imageapi_imagemagick_image_close in ./imageapi_imagemagick.module

File

./imageapi_imagemagick.module, line 146
ImageMagick toolkit functions

Code

function _imageapi_imagemagick_convert($source, $dest, $args) {
  $args['quality'] = '-quality ' . escapeshellarg(variable_get('imageapi_imagemagick_quality', 75));

  // To make use of ImageMagick 6's parenthetical command grouping we need to make
  // the $source image the first parameter and $dest the last.
  // See http://www.imagemagick.org/Usage/basics/#cmdline for more info.
  $command = escapeshellarg($source) . ' ' . implode(' ', $args) . ' ' . escapeshellarg($dest);
  if (0 != _imageapi_imagemagick_convert_exec($command, $output, $errors)) {
    return FALSE;
  }
  return file_exists($dest);
}