Answer the question
In order to leave comments, you need to log in
Resize images by sort or counter?
Good time, I'm collecting a
photo gallery:
all the photos are cut in 500x500, but I need 4 photos and 8 photos to be cut in a different resolution ... 500x900.
I do not understand how to specify this to the resizer.
I use a normal resizer in result_modifier:
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
foreach($arResult["ITEMS"] as $cell=>$arItem){
if($arItem["PREVIEW_PICTURE"]['ID']){
$file = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"]['ID'],array("width" => 500, "height" => 500), BX_RESIZE_IMAGE_EXACT, true);
$arResult["ITEMS"][$cell]["PREVIEW_PICTURE"]['WIDTH'] = $file['width'];
$arResult["ITEMS"][$cell]["PREVIEW_PICTURE"]['HEIGHT'] = $file['height'];
$arResult["ITEMS"][$cell]["PREVIEW_PICTURE"]['SRC'] = $file['src'];
}
/*кеш*/
if($file['src'])
$file['src'] = \CUtil::GetAdditionalFileURL($file['src'], true);
$arItem['PREVIEW_PICTURE'] = array_change_key_case($file, CASE_UPPER);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question