Your IP : 172.28.240.42


Current Path : /var/www/html/clients/biblio.e-nkama.ru/includes/
Upload File :
Current File : /var/www/html/clients/biblio.e-nkama.ru/includes/gallery.php

<?php
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("");
?>
<?
CModule::IncludeModule('iblock');

$arSelect = Array("IBLOCK_ID", "ID", "IMAGES");
$arFilter = Array("IBLOCK_ID"=>24,"ID"=>$id);
$res = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter, false, false, $arSelect);

$res = $res->GetNextElement();
$arProps = $res->GetProperties();
$images = Array();

foreach ($arProps["IMAGES"]["VALUE"] as $imageId)
{
	$mini = CFile::ResizeImageGet(
        $imageId,
        array('width' => 258, 'height' => 145),
        BX_RESIZE_IMAGE_EXACT,
        true
    );

    $full = CFile::ResizeImageGet(
        $imageId,
        array('width' => 1280, 'height' => 720),
        BX_RESIZE_IMAGE_PROPORTIONAL_ALT,
        true
    );

    $images[] = array(
        'mini' => $mini['src'],
        'full' => $full['src']
    );
}

if ($images):
?>
	<div class="gallery">
		<div id="gallery" class="owl-carousel owl-theme">
			<?php foreach ($images as $image) : ?>
			<div class="item">
				<a href="<?=$image['full']?>" data-lightbox="gallery">
					<img src="<?=$image['mini']?>" alt="">
				</a>
			</div>
			<?php endforeach; ?>
		</div>
	</div>
	<script>
		window.addEventListener('DOMContentLoaded', function() {
			$('#gallery').owlCarousel({
				loop: false,
				margin: 0,
				nav: true,
				navText: ['', ''],
				responsive: {
					0: {
						items: 1
					},
					768: {
						items: 2
					},
					992: {
						items: 3
					},
					1200: {
						items: 4
					}
				}
			});
		});
</script>
<?
endif;

?>
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>