<?
AddEventHandler("iblock", "OnBeforeIBlockElementAdd", array("rszImage", "OnBeforeIBlockElementUpdate"));
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate", array("rszImage", "OnBeforeIBlockElementUpdate"));
class rszImage
{
function OnBeforeIBlockElementUpdate (&$arFields)
{
if ($arFields["IBLOCK_ID"] == 19){
require_once ($_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/ucresizeimg.class.v2.0.php');
$rsimg = $ucResizeImg->GetResized(array('INPUT_FILE' => $arFields["DETAIL_PICTURE"]["tmp_name"],
'WIDTH' => 960,
'HEIGHT' => 600,
'RESIZE_MODE' => 'STRONG',
'CONTENT_ZONE_X' => 'CENTER',
'CONTENT_ZONE_Y' => 'TOP',
'QUALITY' => 90,)
);
$arFields["DETAIL_PICTURE"]["tmp_name"] = $rsimg;
print_r($arFields);
die();
}
}
}
?> |