public function ImageAPIOptimizeProcessorJpegTran::process in Image Optimize (or ImageAPI Optimize) 7.2
Overrides ImageAPIOptimizeProcessorInterface::process
File
- plugins/
imageapi_optimize/ ImageAPIOptimizeProcessorJpegTran.inc, line 42
Class
Code
public function process($image, $destination) {
$cmd = $this
->getFullPathToBinary();
if (empty($cmd)) {
return FALSE;
}
$dst = $this
->sanitizeFilename($destination);
if ($image->info['mime_type'] == 'image/jpeg') {
$options = array(
'-copy none',
'-optimize',
);
$arguments = array(
$dst,
);
if ($this
->getProgressive()) {
$options[] = '-progressive';
}
$option_string = implode(' ', $options);
$argument_string = implode(' ', array_map('escapeshellarg', $arguments));
$this
->saveCommandStdoutToFile("{$cmd} " . $option_string . ' ' . $argument_string, $dst);
}
return;
}