コード例 #1
0
        public ActionResult GetThumbnail(string fileId, long size)
        {
            var guid      = Guid.Parse(fileId);
            var thumbnail = _filesStorage.GetThumbnail(guid);

            if (thumbnail != null)
            {
                return(File(thumbnail, "image/png"));
            }

            var actor       = _contextService.GetTokenActor(HttpContext);
            var fileLoader  = _contextService.GetFileLoader(actor);
            var fileContent = fileLoader.Download(guid, size);

            thumbnail = _documentRender.RenderPage(fileContent, 1, 0.2);
            if (thumbnail != null)
            {
                _fileSaver.PutThumbnailAsync(guid, thumbnail);
            }

            return(File(thumbnail, "image/png"));
        }