Answer the question
In order to leave comments, you need to log in
How to display a description of photos in Bitrix?
Hello. I can't display photo descriptions.
result_modifier.php
foreach ($arResult["PROPERTIES"]["PHOTO"]["VALUE"] as $imageId)
{
$photo=CFile::GetFileArray($imageId);
$arResizeFile = CFile::ResizeImageGet(
$photo["ID"],
$photo["DESCRIPTION"],
//array("width" => $photo["WIDTH"], 'height' => $photo["HEIGHT"]),
array("width" => 700, 'height' => $photo["HEIGHT"]),
BX_RESIZE_IMAGE_PROPORTIONAL_ALT,
true,
$arWaterMark
);
$arResult["PHOTO"][] = $arResizeFile;
}
<?foreach ($arResult["PHOTO"] as &$PhotoItem) {?>
<?var_dump($arResult["PHOTO"]["DESCRIPTION"]);?>//пишет NULL
<img alt="" title="" src="<?= $PhotoItem['src']?>" width="700">
<?}?>
Answer the question
In order to leave comments, you need to log in
So you need to access the element:
<?php foreach ($arResult['PHOTO'] as $PhotoItem):
$src = $PhotoItem['SRC'];
$desc = $PhotoItem['DESCRIPTION'];
?>
<img alt="<?= $desc ?>" title="<?= $desc ?>" src="<?= $src ?>" width="700">
<?php endforeach; ?>
&$PhotoItem
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question