Commit 1d6afa9b authored by Steven Jones's avatar Steven Jones Committed by Steven Jones
Browse files

Issue #3026254 by amoebanath, Steven Jones: Kraken: Support WebP option

parent 490f7a3e
......@@ -5,6 +5,7 @@ class ImageAPIOptimizeProcessorKraken implements ImageAPIOptimizeProcessorConfig
protected $api_key;
protected $api_secret;
protected $lossy = TRUE;
protected $webp = FALSE;
protected $timeout = 30;
/**
......@@ -20,6 +21,9 @@ class ImageAPIOptimizeProcessorKraken implements ImageAPIOptimizeProcessorConfig
if (isset($data['lossy'])) {
$this->lossy = $data['lossy'];
}
if (isset($data['webp'])) {
$this->webp = $data['webp'];
}
if (isset($data['timeout'])) {
$this->timeout = $data['timeout'];
}
......@@ -57,6 +61,12 @@ class ImageAPIOptimizeProcessorKraken implements ImageAPIOptimizeProcessorConfig
'#default_value' => $this->lossy,
);
$form['webp'] = array(
'#title' => t('Use webp format'),
'#type' => 'checkbox',
'#default_value' => $this->webp,
);
$form['timeout'] = array(
'#title' => t('Timeout (in seconds)'),
'#type' => 'textfield',
......@@ -90,6 +100,13 @@ class ImageAPIOptimizeProcessorKraken implements ImageAPIOptimizeProcessorConfig
return $this->lossy;
}
/**
* @return boolean
*/
public function isWebp() {
return $this->webp;
}
/**
* @return int
*/
......@@ -151,6 +168,7 @@ class ImageAPIOptimizeProcessorKraken implements ImageAPIOptimizeProcessorConfig
'file' => $real_path,
'wait' => TRUE,
'lossy' => (bool) $this->isLossy(),
'webp' => (bool) $this->isWebp(),
);
// Send the request to Kraken.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment