A
A
Alexer052021-05-25 11:56:39
1C-Bitrix
Alexer05, 2021-05-25 11:56:39

How to update the image (preview_image) when updating or adding an infoblock element?

How can I apply my own code to a loaded image when updating or adding an infoblock element?

I'm trying to do it via AddEventHandler()

AddEventHandler('iblock', 'OnAfterIBlockElementUpdate', array('MyClass',  'OnAfterIBlockElementHandler'));
// ...

public function OnAfterIBlockElementHandler(&$arFields)
{
    print_r($arFields['PREVIEW_PICTURE']);
}


but only the ID of the old picture is shown there, and the new picture is not available

Array (
    [name] => Имя_файла.jpg
    [type] => image/jpeg
    [tmp_name] => /path/temp/620/default
    [size] => 74463
    [error] => 0
    [description] =>
    [COPY_FILE] => Y
    [copy] => 1
    [MODULE_ID] => iblock
    [old_file] => 473084
)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question