$arOrder = Array("NAME"=>"ASC");
$arFilter = Array("IBLOCK_ID"=>34,"ACTIVE"=>"Y");
$arGroupBy = false;
$arNavStartParams = false;
$arSelectedFields = false;
$ItemsList = CIBlockElement::GetList($arOrder,$arFilter,$arGroupBy,$arNavStartParams,$arSelectedFields);
$el = new CIBlockElement;
while($arItem = $ItemsList->Fetch()) {
if($arItem["DETAIL_PICTURE"] == "") continue;
$preview_img = CFile::ResizeImageGet($arItem["DETAIL_PICTURE"], array('width'=>120, 'height'=>120), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$arLoadProductArray = Array(
"DETAIL_PICTURE" => CFile::MakeFileArray(CFile::GetPath($arItem["DETAIL_PICTURE"])),
"PREVIEW_PICTURE" => CFile::MakeFileArray($preview_img["src"]),
);
$res = $el->Update($arItem["ID"], $arLoadProductArray);
}
|