Files
kit/templates/picture.php
T
2021-08-14 14:35:10 +03:00

15 lines
588 B
PHP

<?
use Wt\Core\Type;
?>
<picture class="kit-picture <?=$arParams['CLASS']?>">
<?
$webp = new \Bx\Kit\Image\Webp($_SERVER['DOCUMENT_ROOT'] . $arParams['SRC']);
if($webp->convert()->isSuccess()) {
$webpSrc = $webp->getRelativePath();
?><source srcset="<?=$webpSrc?>" type="image/webp"><?
}
?>
<img src="<?=$arParams['SRC']?>" alt="<?=Type\Str::safeHtmlAttr($arParams['ALT'])?>"<?if($arParams['TITLE']) {?> title="<?=Type\Str::safeHtmlAttr($arParams['TITLE'])?>"<?}?>
<?=\Bx\Kit\Node\Lib::getAttrByArray($arParams['ATTR']);?>
/>
</picture>