You are here

function imageapi_optimize_binaries_optipng in Image Optimize (or ImageAPI Optimize) 7

OptiPNG: Advanced PNG Optimizer ImageAPI Optimize binary callback.

File

binaries/optipng.inc, line 55
OptiPNG: Advanced PNG Optimizer integration.

Code

function imageapi_optimize_binaries_optipng($image, $dst, $cmd, $settings) {
  if ($image->info['mime_type'] == 'image/png') {
    $args = '';
    $args .= '-o' . $settings['level'] . ' ';
    if (is_numeric($settings['interlace'])) {
      $args .= '-i ' . $settings['interlace'] . ' ';
    }
    exec("{$cmd} -quiet " . $args . escapeshellarg($dst));
  }
}