预览图测试接口提交
							parent
							
								
									4315ea7571
								
							
						
					
					
						commit
						76aa9de80c
					
				| 
						 | 
					@ -14,6 +14,8 @@ using IRaCIS.Core.Application.Service.Inspection.DTO;
 | 
				
			||||||
using Nito.AsyncEx;
 | 
					using Nito.AsyncEx;
 | 
				
			||||||
using IRaCIS.Application.Interfaces;
 | 
					using IRaCIS.Application.Interfaces;
 | 
				
			||||||
using IRaCIS.Core.Infrastructure;
 | 
					using IRaCIS.Core.Infrastructure;
 | 
				
			||||||
 | 
					using SixLabors.ImageSharp.Processing;
 | 
				
			||||||
 | 
					using SixLabors.ImageSharp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace IRaCIS.Core.Application.Contracts
 | 
					namespace IRaCIS.Core.Application.Contracts
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -205,15 +207,32 @@ namespace IRaCIS.Core.Application.Contracts
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //[HttpGet]
 | 
					        [HttpGet]
 | 
				
			||||||
        //public async Task<FileContentResult> NoneDicomFilePreview(string relativePath)
 | 
					        public async Task<FileContentResult> NoneDicomFilePreview(string relativePath)
 | 
				
			||||||
        //{
 | 
					        {
 | 
				
			||||||
        //    var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName;
 | 
					            var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //    var _fileStorePath = Path.Combine(rootPath, relativePath);
 | 
					            var _fileStorePath = Path.Combine(rootPath, relativePath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
           
 | 
					            var storePreviewPath = _fileStorePath + ".preview.jpeg";
 | 
				
			||||||
        //}
 | 
					
 | 
				
			||||||
 | 
					            if (!File.Exists(storePreviewPath))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                using (var image = SixLabors.ImageSharp.Image.Load(await File.ReadAllBytesAsync(_fileStorePath)))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    image.Mutate(x => x
 | 
				
			||||||
 | 
					                         .Resize(image.Width / 2, image.Height / 2)
 | 
				
			||||||
 | 
					                         );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    await image.SaveAsJpegAsync(storePreviewPath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
 | 
					            return new FileContentResult(await File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 上传非Dicom 文件 支持压缩包
 | 
					        /// 上传非Dicom 文件 支持压缩包
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue