Skip to content

Commit

Permalink
Fixed predefined option in the decoding attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoreno.rodriguez committed Feb 2, 2024
1 parent 5d3407a commit ccdf3e7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions system/src/Grav/Common/Media/Traits/ImageDecodingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}

0 comments on commit ccdf3e7

Please sign in to comment.