class JfifRemove in Image Optimize Binaries 8
Uses the JfifRemove binary to optimize images.
Plugin annotation
@ImageAPIOptimizeProcessor(
id = "jfifremove",
label = @Translation("JfifRemove"),
description = @Translation("Uses the JfifRemove binary to optimize images.")
)
Hierarchy
- class \Drupal\imageapi_optimize_binaries\ImageAPIOptimizeProcessorBinaryBase extends \Drupal\imageapi_optimize\ConfigurableImageAPIOptimizeProcessorBase
- class \Drupal\imageapi_optimize_binaries\Plugin\ImageAPIOptimizeProcessor\JfifRemove
Expanded class hierarchy of JfifRemove
File
- src/
Plugin/ ImageAPIOptimizeProcessor/ JfifRemove.php, line 16
Namespace
Drupal\imageapi_optimize_binaries\Plugin\ImageAPIOptimizeProcessorView source
class JfifRemove extends ImageAPIOptimizeProcessorBinaryBase {
/**
* {@inheritdoc}
*/
protected function executableName() {
return 'jfifremove';
}
public function applyToImage($image_uri) {
if ($cmd = $this
->getFullPathToBinary()) {
if ($this
->getMimeType($image_uri) == 'image/jpeg') {
$dst = $this
->sanitizeFilename($image_uri);
$options = array();
$arguments = array(
$dst,
);
$option_string = implode(' ', $options);
$argument_string = implode(' ', array_map('escapeshellarg', $arguments));
return $this
->saveCommandStdoutToFile(escapeshellarg($cmd) . ' ' . $option_string . ' < ' . $argument_string, $dst);
}
}
return FALSE;
}
}