Admin_AssetController::getVideoThumbnailAction PHP Метод

getVideoThumbnailAction() публичный Метод

    public function getVideoThumbnailAction()
    {
        if ($this->getParam("id")) {
            $video = Asset::getById(intval($this->getParam("id")));
        } elseif ($this->getParam("path")) {
            $video = Asset::getByPath($this->getParam("path"));
        }
        $thumbnail = $this->getAllParams();
        if ($this->getParam("treepreview")) {
            $thumbnail = Asset\Image\Thumbnail\Config::getPreviewConfig();
        }
        $time = null;
        if ($this->getParam("time")) {
            $time = intval($this->getParam("time"));
        }
        if ($this->getParam("settime")) {
            $video->removeCustomSetting("image_thumbnail_asset");
            $video->setCustomSetting("image_thumbnail_time", $time);
            $video->save();
        }
        $image = null;
        if ($this->getParam("image")) {
            $image = Asset::getById(intval($this->getParam("image")));
        }
        if ($this->getParam("setimage") && $image) {
            $video->removeCustomSetting("image_thumbnail_time");
            $video->setCustomSetting("image_thumbnail_asset", $image->getId());
            $video->save();
        }
        $thumb = $video->getImageThumbnail($thumbnail, $time, $image);
        $thumbnailFile = $thumb->getFileSystemPath();
        header("Content-type: image/" . File::getFileExtension($thumbnailFile), true);
        header("Content-Length: " . filesize($thumbnailFile), true);
        $this->sendThumbnailCacheHeaders();
        while (@ob_end_flush()) {
        }
        flush();
        readfile($thumbnailFile);
        exit;
    }