Meine Lösung für SVGs:
templates/image_svg.html5
PHP-Code:
<figure class="image_container<?= $this->floatClass ?>"<?php if ($this->margin): ?> style="<?= $this->margin ?>"<?php endif; ?>>
<?php if ($this->imageHref || $this->href): ?>
<a href="<?= $this->imageHref ?: $this->href ?>"<?php if ($this->linkTitle): ?> title="<?= $this->linkTitle ?>"<?php endif; ?><?= $this->attributes ?>>
<?php endif; ?>
<?php
$size = deserialize($this->size);
$picture = $this->picture;
if($size[0]){
$picture["rem"] = $size[0] / 10;
}
$this->insert('picture_svg', $picture); ?>
<?php if ($this->imageHref || $this->href): ?>
</a>
<?php endif; ?>
<?php if ($this->caption): ?>
<?php if ($this->imageHref || $this->href): ?>
<a href="<?= $this->imageHref ?: $this->href ?>"<?php if ($this->linkTitle): ?> title="<?= $this->linkTitle ?>"<?php endif; ?><?= $this->attributes ?>>
<?php endif; ?>
<figcaption class="caption"><?= $this->caption ?></figcaption>
<?php if ($this->imageHref || $this->href): ?>
</a>
<?php endif; ?>
<?php endif; ?>
</figure>
templates/picture_svg.html5
PHP-Code:
<?php
$xml = new SimpleXMLElement(file_get_contents('https://'.$this->Environment->httpHost.'/'.$this->img['src']));
$xml->addAttribute("width",$this->img["width"]);
$xml->addAttribute("height",$this->img["height"]);
$xml->addAttribute("style","width: " . $this->rem . "rem; height:auto");
echo $xml->asXML();
?>
templates/ce_text_svg.html5
PHP-Code:
<?php $this->extend('block_searchable'); ?>
<?php $this->block('content'); ?>
<?php if (!$this->addBefore): ?>
<div class="text"><div class="inner">
<?= $this->text ?>
</div></div>
<?php endif; ?>
<?php if ($this->addImage): ?>
<?php $this->insert('image_svg', $this->arrData); ?>
<?php endif; ?>
<?php if ($this->addBefore): ?>
<div class="text"><div class="inner">
<?= $this->text ?>
</div></div>
<?php endif; ?>
<?php $this->endblock(); ?>
Lesezeichen