public function PngQuant::buildConfigurationForm in Image Optimize Binaries 8
Overrides ImageAPIOptimizeProcessorBinaryBase::buildConfigurationForm
File
- src/
Plugin/ ImageAPIOptimizeProcessor/ PngQuant.php, line 77
Class
- PngQuant
- Uses the PngQuant binary to optimize images.
Namespace
Drupal\imageapi_optimize_binaries\Plugin\ImageAPIOptimizeProcessorCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['speed'] = [
'#title' => $this
->t('Speed'),
'#type' => 'select',
'#options' => array_combine(range(1, 10), range(1, 10)),
'#default_value' => $this->configuration['speed'],
'#required' => TRUE,
'#description' => $this
->t('1 (brute-force) to 10 (fastest). The pngquant default is 3. Speed 10 has 5% lower quality, but is about 8 times faster than the default.'),
];
$form['quality'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Quality'),
'#description' => $this
->t('Minimum and Maximum are numbers in the range 0 (worst) to 100 (perfect), similar to JPEG.<br/>pngquant will use the least amount of colors required to meet or exceed the max quality.<br/>If conversion results in quality below the min quality the 24-bit original will be output.'),
];
$form['quality']['min'] = [
'#title' => $this
->t('Minimum'),
'#type' => 'number',
'#min' => 0,
'#max' => 100,
'#step' => 1,
'#default_value' => $this->configuration['quality']['min'],
];
$form['quality']['max'] = [
'#title' => $this
->t('Maximum'),
'#type' => 'number',
'#min' => 0,
'#max' => 100,
'#step' => 1,
'#default_value' => $this->configuration['quality']['max'],
];
return $form;
}