public function AdvDef::applyToImage in Image Optimize Binaries 8
Overrides ImageAPIOptimizeProcessorBinaryBase::applyToImage
File
- src/
Plugin/ ImageAPIOptimizeProcessor/ AdvDef.php, line 26
Class
- AdvDef
- Uses the AdvDef binary to optimize images.
Namespace
Drupal\imageapi_optimize_binaries\Plugin\ImageAPIOptimizeProcessorCode
public function applyToImage($image_uri) {
if ($cmd = $this
->getFullPathToBinary()) {
if ($this
->getMimeType($image_uri) == 'image/png') {
$options = array(
'--quiet',
);
$arguments = array(
$this
->sanitizeFilename($image_uri),
);
if ($this->configuration['recompress']) {
$options[] = '--recompress';
}
$options[] = '-' . $this->configuration['mode'];
return $this
->execShellCommand($cmd, $options, $arguments);
}
}
return FALSE;
}