Answer the question
In order to leave comments, you need to log in
CFile::ResizeImageGet not working with UF section properties?
In general, the following situation: There are sections in the infoblock and it has a user property file, multiple. It was possible through result_modifer.php to get an array with the paths to the file and place it in the cell I need, but the CFile::ResizeImageGet function refuses to work. What could be the reason? and how to solve this problem? Below are the file listings.
result_modifier.php
//ICON PATH AND PORTFOLIO
foreach($arResult['SECTIONS'] as $key => $sections){
$arResult["SECTIONS"][$key]["ICON_PATH"] = CFile::GetPath($sections['UF_ICON']);
if($arResult['SECTION']['ID'] == $sections['ID']){
foreach($sections["UF_PORTFOLIO"] as $k => $portolio){
$arResult["SECTION"]["PORTFOLIO"][$k]["ID"] = $portolio;
$arResult["SECTION"]["PORTFOLIO"][$k]["SRC"] = CFile::GetPath($portolio);
}
}
}
<?if(!empty($arResult["SECTION"]["PORTFOLIO"])){?>
<section class="portfolio-module">
<?foreach($arResult["SECTION"]["PORTFOLIO"] as $arPortfolio){
$resizePhoto = CFile::ResizeImageGet($arPortfolio, array('width'=>500, 'height'=>450), BX_RESIZE_IMAGE_PROPORTIONAL, true);
?>
<img src="<?=$resizePhoto['src'];?>">
<?}?>
</section>
<?}?>
Answer the question
In order to leave comments, you need to log in
1st parameter - File identifier from the b_file table or file description array (Array(FILE_NAME, SUBDIR, WIDTH, HEIGHT, CONTENT_TYPE)) obtained by the GetFileArray method.
Check if what you put in a function fits this description
In CFile::ResizeImageGet, the ID of the image file must be passed as the first parameter:
<?foreach($arResult["SECTION"]["PORTFOLIO"] as $arPortfolio){
$resizePhoto = CFile::ResizeImageGet($arPortfolio, array('width'=>500, 'height'=>450), BX_RESIZE_IMAGE_PROPORTIONAL, true);
?>
<img src="<?=$resizePhoto['src'];?>">
<?}?>
<?foreach($arResult["SECTION"]["PORTFOLIO"] as $arPortfolio){
$resizePhoto = CFile::ResizeImageGet($arPortfolio["ID"], array('width'=>500, 'height'=>450), BX_RESIZE_IMAGE_PROPORTIONAL, true);
?>
<img src="<?=$resizePhoto['src'];?>">
<?}?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question