docs: #263 returning normal sized images for deleted original files
This commit is contained in:
parent
31a04465fd
commit
ff7c473fe5
@ -54,12 +54,21 @@ namespace RMuseum.Controllers
|
||||
if(!string.IsNullOrEmpty(imgPath.ExceptionString))
|
||||
return BadRequest(imgPath.ExceptionString);
|
||||
|
||||
if(!System.IO.File.Exists(imgPath.Result))
|
||||
if(string.IsNullOrEmpty(imgPath.Result))
|
||||
{
|
||||
return NotFound();
|
||||
if(size == "orig")
|
||||
{
|
||||
imgPath = _pictureFileService.GetImagePath(img.Result, "norm");
|
||||
if (!string.IsNullOrEmpty(imgPath.ExceptionString))
|
||||
return BadRequest(imgPath.ExceptionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new FileStreamResult(new FileStream(imgPath.Result, FileMode.Open, FileAccess.Read),
|
||||
size == "orig" ?
|
||||
img.Result.ContentType
|
||||
|
||||
@ -258,6 +258,8 @@ namespace RMuseum.Services.Implementation
|
||||
public RServiceResult<string> GetImagePath(RPictureFile image, string sz = "orig")
|
||||
{
|
||||
string fileName = sz == "thumb" ? image.ThumbnailImageStoredFileName : sz == "norm" ? image.NormalSizeImageStoredFileName : image.StoredFileName;
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
return new RServiceResult<string>(null);
|
||||
return new RServiceResult<string>(Path.Combine(ImageStoragePath, image.FolderName, fileName));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user