$file_path = 'images/pic.jpg'; $image_size = CFile::GetImageSize($file_path); echo $image_size[0]; // width echo $image_size[1]; // height echo $image_size[2]; // type
$file_path = 'images/pic.png'; $image_size = CFile::GetImageSize($file_path, Array('width' => 100)); echo $image_size[0]; // width echo $image_size[1]; // height echo $image_size[2]; // typeIn this example, we're retrieving the size of the file 'pic.png' located in the 'images' folder of our website. We're using the CFile GetImageSize function to get the width, height, and type of the image. We're also passing an additional parameter to indicate the maximum width of the image. The CFile GetImageSize function belongs to the Bitrix framework library, which is used for developing websites on the Bitrix CMS.