缩略图
parent
db15a3fb7b
commit
396eaf7e68
|
@ -17,6 +17,7 @@ using IRaCIS.Core.Infrastructure;
|
||||||
using SixLabors.ImageSharp.Processing;
|
using SixLabors.ImageSharp.Processing;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
@ -211,7 +212,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
return await _repository.Where<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == subjectVisitId).ProjectTo<NoneDicomStudyFileView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }).ToListAsync();
|
return await _repository.Where<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == subjectVisitId).ProjectTo<NoneDicomStudyFileView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<FileContentResult> NoneDicomFilePreview(string relativePath)
|
public async Task<FileContentResult> NoneDicomFilePreview(string relativePath)
|
||||||
{
|
{
|
||||||
|
@ -225,19 +226,19 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
var storePreviewPath = _fileStorePath + ".preview.jpeg";
|
var storePreviewPath = _fileStorePath + ".preview.jpeg";
|
||||||
|
|
||||||
if (!File.Exists(storePreviewPath))
|
//if (!File.Exists(storePreviewPath))
|
||||||
{
|
//{
|
||||||
|
|
||||||
using (var image = SixLabors.ImageSharp.Image.Load(await File.ReadAllBytesAsync(_fileStorePath)))
|
using (var image = SixLabors.ImageSharp.Image.Load(await File.ReadAllBytesAsync(_fileStorePath)))
|
||||||
{
|
{
|
||||||
image.Mutate(x => x
|
image.Mutate(x => x
|
||||||
.Resize(image.Width / 2, image.Height / 2)
|
.Resize(400, 400)
|
||||||
);
|
);
|
||||||
|
|
||||||
await image.SaveAsJpegAsync(storePreviewPath);
|
await image.SaveAsJpegAsync(storePreviewPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
return new FileContentResult(await File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
|
return new FileContentResult(await File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue