mudanças

This commit is contained in:
José Henrique Ivanchechen 2023-08-29 16:20:40 -03:00
parent 150ec0e1d7
commit 2085b7d89b
4 changed files with 8 additions and 21 deletions

View File

@ -34,25 +34,13 @@ namespace TCC.Controllers
[HttpGet("load-image")]
public async Task<IActionResult> GetSimpleImage()
{
var result = ImageService.GetSimpleImage();
var imageStream = new MemoryStream();
result.Write(imageStream);
imageStream.Position = 0;
return File(imageStream, "image/png");
return File(ImageService.GetSimpleImage(), "image/png");
}
[HttpGet("load-big-image")]
public async Task<IActionResult> GetBigImage()
{
var result = ImageService.GetBigImage();
var imageStream = new MemoryStream();
result.Write(imageStream);
imageStream.Position = 0;
return File(imageStream, "image/png");
return File(ImageService.GetBigImage(), "image/png");
}
[HttpPost("save-big-image")]

View File

@ -4,13 +4,13 @@ namespace tcc_app
{
public static class ImageHelper
{
public static MagickImage SimpleImage;
public static MagickImage BigImage;
public static byte[] SimpleImage;
public static byte[] BigImage;
static ImageHelper()
{
SimpleImage = new MagickImage("simpleimage.png");
BigImage = new MagickImage("bigimage.png");
SimpleImage = File.ReadAllBytes("static/simpleimage.png");
BigImage = File.ReadAllBytes("static/bigimage.png");
}
}
}

View File

@ -19,7 +19,6 @@ namespace TCC
options.Limits.MaxRequestBodySize = int.MaxValue; // if don't set default value is: 30 MB
});
var app = builder.Build();
app.UseStaticFiles(new StaticFileOptions

View File

@ -62,12 +62,12 @@ namespace TCC.Services
file.Close();
}
public MagickImage GetSimpleImage()
public byte[] GetSimpleImage()
{
return ImageHelper.SimpleImage;
}
public MagickImage GetBigImage()
public byte[] GetBigImage()
{
return ImageHelper.BigImage;
}