AddEventHandler('iblock', 'OnAfterIBlockElementAdd', 'OnAfterIBlockElementAddHandler');
function OnAfterIBlockElementAddHandler(&$arFields){
CModule::IncludeModule('iblock');
CAllFile::resizeImage(
$arFields['PREVIEW_PICTURE'],
['width' => 405, 'height' => 300],
BX_RESIZE_IMAGE_PROPORTIONAL
);
}
$file = CFile::resizeImageGet(
$arFields['PREVIEW_PICTURE_ID'],
['width' => 405, 'height' => 300],
BX_RESIZE_IMAGE_PROPORTIONAL
);
$file['del'] = 'Y';
$fields = [
'PREVIEW_PICTURE' => CFile::makeFileArray($file['src'])
];
$el = new CIBlockElement;
$el->update($arFields['ID'], $fields);