Skip to content

Instantly share code, notes, and snippets.

@dnikonov
Last active December 3, 2019 09:33
Show Gist options
  • Save dnikonov/b35379253d2e37c51ea159cfbaadb0f2 to your computer and use it in GitHub Desktop.
Save dnikonov/b35379253d2e37c51ea159cfbaadb0f2 to your computer and use it in GitHub Desktop.
// result_modifier.php
// превью изображений
foreach ($arResult["ITEMS"] as $key => &$arItem) {
if ($arItem["PREVIEW_PICTURE"]) {
$arItem["PREVIEW_PICTURE_THUMB"] = array_change_key_case(CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"], array("width" => 500, "height" => 500), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, true), CASE_UPPER);
}
if ($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["VALUE"]) {
if (count($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["VALUE"]) == 1) {
$arItem["DISPLAY_PROPERTIES"]["SLIDER"]["FILE_VALUE"] = array($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["FILE_VALUE"]);
}
foreach ($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["FILE_VALUE"] as $key2 => $value) {
$arItem["DISPLAY_PROPERTIES"]["SLIDER"]["FILE_VALUE"][$key2]["THUMB"] = array_change_key_case(CFile::ResizeImageGet($value, array("width" => 500, "height" => 500), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, true), CASE_UPPER);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment