Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Issue forks
imageapi_optimize-3226168
Commits
1d6afa9b
Commit
1d6afa9b
authored
Jan 06, 2021
by
Steven Jones
Committed by
Steven Jones
Jan 06, 2021
Browse files
Issue
#3026254
by amoebanath, Steven Jones: Kraken: Support WebP option
parent
490f7a3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/kraken/plugins/ImageAPIOptimizeProcessorKraken.inc
View file @
1d6afa9b
...
...
@@ -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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment