public void Create_CreatesThumbnailFromLargeImageFile_CreatesSingleLandscapeThumbnail()
        {
            //setup
            string originalFileLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"TestImages\largeLandscape.gif");

            //act
            _thumbnailer.Create(100, ThumbnailFolder, originalFileLocation);

            string[] images = Directory.GetFiles(ThumbnailFolder);

            //assert
            Assert.IsTrue(images.Length == 1);
            Assert.AreEqual(images.Length, 1);
        }
예제 #2
0
        public async Task OnPostAsync()
        {
            // if upload directory doesn't exist, create it
            _thumbnailer.CheckAndCreateDirectory(_uploadFolder);

            var thumbnailPath = await _thumbnailer.Create(200, _uploadFolder, $"{_uploadFolder}\\originals", Upload, 90L);

            _logger.LogInformation($"Successfully uploaded {Upload.FileName} to {thumbnailPath}");
        }
 /// <summary>
 /// Use the NuGet package ImageThumbnailCreator to create a thumbnail and return the path to the thumbnail.
 /// </summary>
 /// <param name="width"></param>
 /// <param name="fullImagePath"></param>
 /// <returns></returns>
 public static string ProcessThumbnail(float width, string fullImagePath)
 {
     return(_thumbnailer.Create(width, projectImageFolder, Path.Combine(projectImageFolder, fullImagePath)).Split('\\').Last());
 }