You are here

function imageapi_optimize_binaries_jpegtran in Image Optimize (or ImageAPI Optimize) 7

JPEGTran ImageAPI Optimize binary callback.

File

binaries/jpegtran.inc, line 41
JPEGTran integration.

Code

function imageapi_optimize_binaries_jpegtran($image, $dst, $cmd, $settings) {
  if ($image->info['mime_type'] == 'image/jpeg') {
    $args = '';
    if ($settings['progressive']) {
      $args .= '-progressive ';
    }
    if (substr(PHP_OS, 0, 3) == 'WIN') {
      passthru("{$cmd} -copy none -optimize " . $args . escapeshellarg($dst) . " " . escapeshellarg($dst), $dst);
    }
    else {
      _imageapi_optimize_exec("{$cmd} -copy none -optimize " . $args . escapeshellarg($dst), $dst);
    }
  }
}