first commit -push

This commit is contained in:
dungtt
2025-10-15 15:15:53 +07:00
parent 674ae395be
commit a9577c5756
885 changed files with 74595 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using System.IO;
using System.Threading.Tasks;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Processing;
namespace RobotNet.IdentityServer.Services;
public class UserImageService
{
public async Task<(byte[] ImageBytes, string ContentType)> ResizeAndConvertAsync(Stream input)
{
using var image = await Image.LoadAsync(input);
image.Mutate(x => x.Resize(new ResizeOptions
{
Size = new Size(300, 300),
Mode = ResizeMode.Crop
}));
using var ms = new MemoryStream();
await image.SaveAsJpegAsync(ms, new JpegEncoder { Quality = 90 });
return (ms.ToArray(), "image/jpeg");
}
}