You are here

function imageapi_optimize_binaries_jpegoptim in Image Optimize (or ImageAPI Optimize) 7

Jpegoptim ImageAPI Optimize binary callback.

File

binaries/jpegoptim.inc, line 47
Jpegoptim integration.

Code

function imageapi_optimize_binaries_jpegoptim($image, $dst, $cmd, $settings) {
  if ($image->info['mime_type'] == 'image/jpeg') {
    $args = '';
    if (is_numeric($settings['progressive'])) {
      switch ($settings['progressive']) {
        case 0:
          $args .= '--all-normal ';
          break;
        case 1:
          $args .= '--all-progressive ';
          break;
      }
    }
    exec("{$cmd} -q --strip-all " . $args . escapeshellarg($dst));
  }
}