Skip to content

Commit

Permalink
fix: Ensure print-request is always evaluated
Browse files Browse the repository at this point in the history
  • Loading branch information
tweis committed Jul 12, 2024
1 parent eb7561f commit c3d2390
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Classes/ViewHelpers/PictureViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*/
class PictureViewHelper extends AbstractTagBasedViewHelper
{
private const MAX_INLINE_IMAGE_SIZE = 50000; // 5KB

/**
* @var string
*/
Expand Down Expand Up @@ -180,14 +178,14 @@ private function getImgTag(FileInterface $image): string
$tag->addAttribute('title', $this->getImageTitle($image));
$tag->addAttribute('src', $processedImageUri);

if ($this->arguments['lazy']) {
$tag->addAttribute('loading', 'lazy');
$tag->addAttribute('decoding', 'async');
$tag->addAttribute('fetchpriority', 'low');
} elseif ($this->isPrintRequest() || $this->arguments['eager']) {
if ($this->isPrintRequest() || $this->arguments['eager']) {
$tag->addAttribute('loading', 'eger');
$tag->addAttribute('fetchpriority', 'high');
$tag->removeAttribute('decoding');
} elseif ($this->arguments['lazy']) {
$tag->addAttribute('loading', 'lazy');
$tag->addAttribute('decoding', 'async');
$tag->addAttribute('fetchpriority', 'low');
}

return $tag->render();
Expand Down

0 comments on commit c3d2390

Please sign in to comment.