Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/burlakastudio.realcommenter/ajax/ |
Upload File : |
<?php require_once 'ajax_header_init.php'; if ( !$access_granted ) { \Burlakastudio\Realcommenter\DEBUGGER::error( \Bitrix\Main\Localization\Loc::getMessage( 'DOMAIN_ACCESS_DENIED' ) ); $json_return[ 'ERROR' ][]= \Bitrix\Main\Localization\Loc::getMessage( 'DOMAIN_ACCESS_DENIED' ); } else { $json_return[ 'request' ]= $posts; $doc_root = \Bitrix\Main\Application::getDocumentRoot(); /** * ������ ��� � ����� �� ��� ID * * ������� ������� ���������� �� ����� ���������� ���, �� � �������������� */ $file_ID_list= $posts[ 'file_id' ]; if ( !$file_ID_list ) { die( 'Wrong file id' ); } if( !is_array( $file_ID_list ) ) { $file_ID_list= [ $file_ID_list ]; } $thumb_size= $posts[ 'thumb_size' ]; if( !$thumb_size ) { $thumb_size= 'small'; } $json_return[ 'file_info' ]= []; /** * ������ ����� getList, � ��������� ������ ����� �����. * ������ ��� ����� ���� ��� ������ � ����� �����, ������ ���� �������� ���������� * */ $file_info_D7_res= \Bitrix\Main\FileTable::getList( [ 'filter' => [ 'ID' => $file_ID_list, 'MODULE_ID' => \Burlakastudio\Realcommenter\TOOLS::getModuleName() ], 'select' => [ 'ID', 'SUBDIR', 'FILE_NAME' ], 'limit' => count( $file_ID_list ) ] ); while( $file_info_D7= $file_info_D7_res->fetch() ) { $file_src= $doc_root . '/upload/' . $file_info_D7[ 'SUBDIR' ] . '/' . $file_info_D7[ 'FILE_NAME' ]; $arSize= [ 'width' => \Burlakastudio\Realcommenter\OPTIONS::get( 'resize_'. $thumb_size .'_width' ), 'height' => \Burlakastudio\Realcommenter\OPTIONS::get( 'resize_'. $thumb_size .'_height' ), ]; //29-01-title.jpg list( $_filename, $_fileext )= explode( '.', $file_info_D7[ 'FILE_NAME' ] ); $file_thumb= sprintf( '/upload/%s/%s_uplthumb_%s_%s.%s', $file_info_D7[ 'SUBDIR' ], $_filename, $arSize[ 'width' ], $arSize[ 'height' ], $_fileext ); $file_thumb_full= $doc_root . $file_thumb; $resize_result= \CFile::ResizeImageFile( $file_src, $file_thumb_full, $arSize ); if ( !$resize_result ) { die( 'Resize error' ); } $json_return[ 'file_info' ][]= [ 'file_id' => $file_info_D7[ 'ID' ], 'THUMB' => $file_thumb, ]; } } require_once 'ajax_footer.php';