minor SVG improvements
* never try to use slika to resize SVGs - let the browser do it * use object-fit:cover for all images - this properly crops inside the browser if the backend didn't (like for SVGs). currently dokuwiki template only - might be worth moving to default styles * show previews for SVGs in media manager
This commit is contained in:
parent
aec2ae89d7
commit
8e9d8d552b
|
@ -39,7 +39,14 @@ class Display
|
|||
$src = $this->getIconUrl();
|
||||
}
|
||||
|
||||
return '<img src="' . $src . '" alt="' . hsc($this->mediaFile->getDisplayName()) . '" loading="lazy" />';
|
||||
$attr = [
|
||||
'alt' => $this->mediaFile->getDisplayName(),
|
||||
'loading' => 'lazy',
|
||||
'width' => $w,
|
||||
'height' => $h,
|
||||
];
|
||||
|
||||
return '<img src="' . $src . '" ' . buildAttributes($attr) . ' />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,7 +48,7 @@ class DisplayRow extends DisplayTile
|
|||
echo '<div class="example" id="ex_' . str_replace(':', '_', $id) . '">';
|
||||
echo $lang['mediausage'] . ' <code>{{:' . $id . '}}</code>';
|
||||
echo '</div>';
|
||||
if ($this->mediaFile->getWidth()) $this->showDetails();
|
||||
if ($this->mediaFile->isImage()) $this->showDetails();
|
||||
echo '<div class="clearer"></div>' . NL;
|
||||
echo '</div>' . NL;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -218,7 +218,7 @@ img {
|
|||
color: #666;
|
||||
background-color: transparent;
|
||||
font-style: italic;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
video {
|
||||
height: auto;
|
||||
|
|
Loading…
Reference in New Issue