Fixed predefined option in the decoding attribute

This commit is contained in:
pmoreno.rodriguez 2024-02-02 08:41:41 +01:00
parent 5d3407a192
commit ccdf3e7190

View File

@ -25,17 +25,16 @@ trait ImageDecodingTrait
*/
public function decoding($value = null)
{
$validValues = ['sync', 'async', 'auto'];
if (null === $value) {
$value = Grav::instance()['config']->get('system.images.defaults.decoding', 'auto');
}
// Validate the provided value
if ($value && in_array($value, $validValues, true)) {
// Validate the provided value (similar to loading)
if ($value !== null && $value !== 'auto') {
$this->attributes['decoding'] = $value;
}
return $this;
}
}