Answer the question
In order to leave comments, you need to log in
How to display PREVIEW_PICTURE in horizontal_multilevel template.php?
In the template like this:
<?if ($arItem["DEPTH_LEVEL"] == 1):?>
<li class="<?if ($arItem["SELECTED"]):?>active<?endif?>"><a href="<?=$arItem["LINK"]?>"><?=$arItem["TEXT"]?></a></li>
<?else:?>
<li<?if ($arItem["SELECTED"]):?> class="item-selected"<?endif?>>
<a href="<?=$arItem["LINK"]?>"><?=$arItem["TEXT"]?></a>
<img src="<?=$arItem["PREVIEW_PICTURE"]["SRC"]?>" /></li>
<?endif?>
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
foreach($arResult["ITEMS"] as $i=>$arItem) {
if (is_array($arItem["PREVIEW_PICTURE"])) {
$ratio = $arItem["PREVIEW_PICTURE"]["WIDTH"] / $arItem["PREVIEW_PICTURE"]["HEIGHT"];
$width = 250;
$height = round($width / $ratio);
$img = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"], array("width" => $width, "height" => $height), BX_RESIZE_IMAGE_EXACT);
$arResult["ITEMS"][$i]["PREVIEW_PICTURE"]["SRC"] = $img["src"];
$arResult["ITEMS"][$i]["PREVIEW_PICTURE"]["WIDTH"] = $width;
$arResult["ITEMS"][$i]["PREVIEW_PICTURE"]["HEIGHT"] = $height;
}
}
?>
Answer the question
In order to leave comments, you need to log in
CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"]['ID'] ,
1st parameter id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question