|
Ok!
|
|
|
Ok!
|
---|---|---|---|---|
97 | <link rel="stylesheet" href="/animate.min.css" media="none" onload="if(media!='all')media='all'"><noscript><link rel="stylesheet" href="/animate.min.css"></noscript> | link, ускорение загрузки | 130 | Ускорение загрузки сайта уменьшением загрузки css |
96 | function resizeAndConvertImageWebP( $width, $height, $density, $originalFilepath, $resizedFilepath) { $newWidth = $width * $density; $newHeight = $height * $density; $image = new Imagick($originalFilepath); $origImageDimens = $image->getImageGeometry(); $origImgWidth = $origImageDimens['width']; $origImgHeight = $origImageDimens['height']; if($newWidth == 0) { $ratioOfHeight = $newHeight / $origImgHeight; $newWidth = $origImgWidth * $ratioOfHeight; } if($newHeight == 0) { $ratioOfWidth = $newWidth / $origImgWidth; $newHeight = $origImgHeight * $ratioOfWidth; } $widthRatios = $origImgWidth / $newWidth; $heightRatios = $origImgHeight / $newHeight; if($widthRatios <= $heightRatios) { $cropWidth = $origImgWidth; $cropHeight = $newWidth * $widthRatios; } else { $cropWidth = $newHeight * $heightRatios; $cropHeight = $origImgHeight; } $cropX = ($origImgWidth - $cropWidth) / 2; $cropY = ($origImgHeight - $cropHeight) / 2; $image->stripImage(); $image->cropImage($cropWidth, $cropHeight, $cropX, $cropY); $image->resizeImage($newWidth, $newHeight, imagick::FILTER_LANCZOS, 0.9); $image->setImageFormat('webp'); $image->setImageAlphaChannel(imagick::ALPHACHANNEL_ACTIVATE); $image->setBackgroundColor(new ImagickPixel('transparent')); $image->writeImage($resizedFilepath); } | webp,support,imagemagic | 140 | Конвертация картинки в webp в случае, если imageMagic поддрживает |
95 | <?=(webps() && is_file($_SERVER['DOCUMENT_ROOT'] . str_replace('.jpg', '.webp', $arItem["DETAIL_PICTURE"]["SRC"])))?'style="background-image: url('.str_replace('.jpg', '.webp', $arItem["DETAIL_PICTURE"]["SRC"]).')':'style="background-image: url('.$arItem["DETAIL_PICTURE"]["SRC"].')'?>" | webp,support | 120 | Бэкграунд если готов файл webp |
94 | $webpsupport = (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') >= 0); if($webpsupport) { $this->attemptToServeWebP($pathinfo, $matches, $width, $height, $density); } else { $this->attemptToServeNormal($pathinfo, $matches, $width, $height, $density); } | webp,support | 100 | Определить, поддерживает ли браузер webp картинки |
93 | <?=($this->GetFolder().'/images/ .... ?> | картинка шаблона инфоблока | 3200 | Путь картинки из папки images размещенной в шаблоне компонента |
92 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $path = $protocol . $_SERVER['HTTP_HOST'] . SITE_TEMPLATE_PATH; | битрикс, путь | 1450 | Путь до файла без слеша на конце |
91 | При ошибке 502 в импорте инфоблоков Битрикс Заменить в файле /bitrix/modules/iblock/admin/iblock_xml_import.php if($obXMLFile->ReadXMLToDatabase($fp, $NS, $INTERVAL)) на if($obXMLFile->ReadXMLToDatabase($fp, $NS, 10, $INTERVAL)) | 502, битрикс, инфоблок, ошибка импорта | 140 | Ошибка импорта инфоблока Битрикс 502 |
90 | center iframe { width: 100%; height: calc(100vw * 9 / 16 ); } | iframe, youtube, height | 120 | Установить размер iframe видео с Youtube, подогнать его под мобильный размер. При условии, что видео 100% ширны. |
89 | $post = get_post(); $t = strtotime($post->post_modified_gmt); $str = 'Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT'; header('Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT'); | daremodified, wp, php | 1200 | WP date modified php file |
88 | document.addEventListener("DOMContentLoaded", function(event) { var cl = document.getElementById('#all_otz'); cl.onclick = function(ev) { var post = {}; post['num_otz'] = 20; post['ajax'] = 'y'; node = BX('video_feed_block'); if (!!node) { BX.ajax.post( 'https://www.brtclinic.ru/index.php', post, function (data) { var el = data.getElementById('video_feed_block'); node.innerHTML = el.innerHTML(); } ); } } }); | битрикс, битрикс аякс | 1090 | Битрикс функция вместо jQuery ajax |