Beispiel #1
0
        internal async Task PreGenerateThumbnail(IEnumerable <FileIndexItem> fileIndexItemsList, string publishProfileName)
        {
            var skipExtraLarge = ShouldSkipExtraLarge(publishProfileName);

            foreach (var item in fileIndexItemsList)
            {
                await _thumbnailService.CreateThumb(item.FilePath, item.FileHash, skipExtraLarge);
            }
        }
Beispiel #2
0
        internal async Task WorkItem(string subPath, IStorage subPathStorage,
                                     IStorage thumbnailStorage)
        {
            try
            {
                _logger.LogInformation($"[ThumbnailGenerationController] start {subPath}");
                var thumbnail = new Thumbnail(subPathStorage,
                                              thumbnailStorage, _logger);
                var thumbs = await thumbnail.CreateThumb(subPath);

                var getAllFilesAsync = await _query.GetAllFilesAsync(subPath);

                var result = new List <FileIndexItem>();
                foreach (var item in
                         getAllFilesAsync.Where(item => thumbs.FirstOrDefault(p => p.Item1 == item.FilePath).Item2))
                {
                    if (item.Tags.Contains("!delete!"))
                    {
                        continue;
                    }

                    item.SetLastEdited();
                    result.Add(item);
                }

                if (!result.Any())
                {
                    return;
                }

                var webSocketResponse =
                    new ApiNotificationResponseModel <List <FileIndexItem> >(result, ApiNotificationType.ThumbnailGeneration);
                await _connectionsService.SendToAllAsync(webSocketResponse, CancellationToken.None);

                _logger.LogInformation($"[ThumbnailGenerationController] done {subPath}");
            }
            catch (UnauthorizedAccessException e)
            {
                _logger.LogError($"[ThumbnailGenerationController] catch-ed exception {e.Message}", e);
            }
        }
Beispiel #3
0
    protected void savedocs(FileUpload fup, string PID, int index)
    {
        string file, orgpath, path, name, ext;

        file = fup.FileName;
        if (file != "")
        {
            ext     = Path.GetExtension(file);
            name    = PID;
            file    = name + ext;
            orgpath = Request.PhysicalApplicationPath + "PersonelImage\\" + PID;

            if (!(System.IO.Directory.Exists(orgpath)))
            {
                System.IO.Directory.CreateDirectory(orgpath);
            }
            path = orgpath + "\\";

            fup.SaveAs(path + file);
            Thumbnail.CreateThumb(path + file, 150, path + "thm-" + file, false);
        }
    }
Beispiel #4
0
 /// <summary>
 /// Create an Thumbnail based on the default sizes
 /// </summary>
 /// <param name="subPath">path on disk (subPath) based</param>
 /// <returns>true if success</returns>
 public Task <List <(string, bool)> > CreateThumb(string subPath)
 {
     // Async method:
     return(_thumbnail.CreateThumb(subPath));
 }