public void Crop(PhotoCropDto photoCropDto) { PhotoSupportService photoSupportService = new PhotoSupportService(_unitOfWork); PhotoResourceDto photoResourceDto = Read(photoCropDto.Id); if (photoResourceDto != null) { photoSupportService.Crop(photoCropDto); } }
public override PhotoResourceDto Upload(PhotoResourceDto photoResourceDto) { PhotoSupportService photoSupportService = new PhotoSupportService(_unitOfWork); IOUtils.CreateDirectories(photoResourceDto.GetAbsolutePath()); Size maximumPhotoSize = GetMaximumPhotoSize(photoResourceDto); Image imageFromStream = Image.FromStream(photoResourceDto.Stream); Image image = photoSupportService.Resize(imageFromStream, 1024, 768); Image thumbnail = photoSupportService.Resize(imageFromStream, maximumPhotoSize.Width, maximumPhotoSize.Height); image.Save(photoResourceDto.GetAbsoluteFilePath(), ImageFormat.Jpeg); thumbnail.Save(photoResourceDto.GetAbsoluteThumbnailFilePath(), ImageFormat.Jpeg); return(photoResourceDto); }