diff --git a/inc/Ui/Media/Display.php b/inc/Ui/Media/Display.php index 16f2137b1..0d2266be2 100644 --- a/inc/Ui/Media/Display.php +++ b/inc/Ui/Media/Display.php @@ -39,7 +39,14 @@ class Display $src = $this->getIconUrl(); } - return '' . hsc($this->mediaFile->getDisplayName()) . ''; + $attr = [ + 'alt' => $this->mediaFile->getDisplayName(), + 'loading' => 'lazy', + 'width' => $w, + 'height' => $h, + ]; + + return ''; } /** diff --git a/inc/Ui/Media/DisplayRow.php b/inc/Ui/Media/DisplayRow.php index 47feed088..32209824f 100644 --- a/inc/Ui/Media/DisplayRow.php +++ b/inc/Ui/Media/DisplayRow.php @@ -48,7 +48,7 @@ class DisplayRow extends DisplayTile echo '
'; echo $lang['mediausage'] . ' {{:' . $id . '}}'; echo '
'; - if ($this->mediaFile->getWidth()) $this->showDetails(); + if ($this->mediaFile->isImage()) $this->showDetails(); echo '
' . NL; echo '' . NL; diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index 92f31a764..40e2f2698 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -91,7 +91,11 @@ if (defined('SIMPLE_TEST')) { //handle image resizing/cropping $evt = new Event('MEDIA_RESIZE', $data); if($evt->advise_before()) { - if((substr($MIME, 0, 5) == 'image') && ($WIDTH || $HEIGHT)) { + if( + $MIME != 'image/svg+xml' && + (substr($MIME, 0, 5) == 'image') && + ($WIDTH || $HEIGHT) + ) { if($HEIGHT && $WIDTH) { $data['file'] = $FILE = media_crop_image($data['file'], $EXT, $WIDTH, $HEIGHT); } else { diff --git a/lib/tpl/dokuwiki/css/basic.less b/lib/tpl/dokuwiki/css/basic.less index be498f6c6..27a144f81 100644 --- a/lib/tpl/dokuwiki/css/basic.less +++ b/lib/tpl/dokuwiki/css/basic.less @@ -218,7 +218,7 @@ img { color: #666; background-color: transparent; font-style: italic; - height: auto; + object-fit: cover; } video { height: auto;