Skip to content

Instantly share code, notes, and snippets.

@ildarkhasanshin
Last active November 4, 2016 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ildarkhasanshin/f5d67a6335771222ce6a8953b8d95a19 to your computer and use it in GitHub Desktop.
Save ildarkhasanshin/f5d67a6335771222ce6a8953b8d95a19 to your computer and use it in GitHub Desktop.
bitrix | resize preview-picture via result_modifier.php
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
foreach ($arResult["ITEMS"] as $key => $arElement) {
if (!empty($arElement["PREVIEW_PICTURE"]["SRC"])) {
$arFileTmp = CFile::ResizeImageGet(
$arElement["PREVIEW_PICTURE"],
array("width" => 100, "height" => 100),
BX_RESIZE_IMAGE_EXACT,
true,
false,
false,
99
);
$arResult["ITEMS"][$key]["PREVIEW_PICTURE"] = array(
"SRC" => $arFileTmp["src"],
"WIDTH" => $arFileTmp["width"],
"HEIGHT" => $arFileTmp["height"],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment