protected function processActionShowFile() { $fileName = $this->file->getName(); $fileData = $this->file->getFile(); if (!$fileData) { $this->end(); } $isImage = TypeFile::isImage($fileData["ORIGINAL_NAME"]); $cacheTime = $isImage ? 86400 : 0; $width = $this->request->getQuery('width'); $height = $this->request->getQuery('height'); if ($isImage && ($width > 0 || $height > 0)) { $signature = $this->request->getQuery('signature'); if (!$signature) { $this->sendJsonInvalidSignResponse('Empty signature'); } if (!ParameterSigner::validateImageSignature($signature, $this->file->getId(), $width, $height)) { $this->sendJsonInvalidSignResponse('Invalid signature'); } /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $tmpFile = \CFile::resizeImageGet($fileData, array("width" => $width, "height" => $height), $this->request->getQuery('exact') == "Y" ? BX_RESIZE_IMAGE_EXACT : BX_RESIZE_IMAGE_PROPORTIONAL, true, false, true); $fileData["FILE_SIZE"] = $tmpFile["size"]; $fileData["SRC"] = $tmpFile["src"]; } \CFile::viewByUser($fileData, array('force_download' => false, 'cache_time' => $cacheTime, 'attachment_name' => $fileName)); }