Cleaned up ReaderController to match the new method of loading images in FE. Sends the full files rather than base64 encoded string.
This commit is contained in:
parent
c6e1fec9f2
commit
2a8931406d
5 changed files with 38 additions and 52 deletions
|
@ -145,26 +145,6 @@ namespace API.Services
|
|||
|
||||
return dirs;
|
||||
}
|
||||
|
||||
public async Task<ImageDto> ReadImageAsync(string imagePath)
|
||||
{
|
||||
if (!File.Exists(imagePath))
|
||||
{
|
||||
_logger.LogError("Image does not exist on disk");
|
||||
return null;
|
||||
}
|
||||
using var image = Image.NewFromFile(imagePath);
|
||||
|
||||
return new ImageDto
|
||||
{
|
||||
Content = await ReadFileAsync(imagePath),
|
||||
Filename = Path.GetFileNameWithoutExtension(imagePath),
|
||||
FullPath = Path.GetFullPath(imagePath),
|
||||
Width = image.Width,
|
||||
Height = image.Height,
|
||||
Format = image.Format,
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<byte[]> ReadFileAsync(string path)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue