Skip to content

Commit

Permalink
Update ImageDetails.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 3, 2023
1 parent 6e2d3e8 commit d97d26c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions BlazorDiffusion.ServiceInterface/ImageDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,20 @@ public static int BackgroundCompare(string rgba1, string rgba2)
{
var originalMs = await ctx.File.InputStream.CopyToNewMemoryStreamAsync();

// Offload persistance of original image to background task
var resizedMs = await CropAndResizeAsync(originalMs, 128, 128, PngFormat.Instance);

// Offload persistence of original image to background task
originalMs.Position = 0;
using var mqClient = HostContext.AppHost.GetMessageProducer(ctx.Request);
mqClient.Publish(new DiskTasks {
SaveFile = new() {
mqClient.Publish(new DiskTasks
{
SaveFile = new()
{
FilePath = ctx.Location.ResolvePath(ctx),
Stream = originalMs,
}
});

var resizedMs = await CropAndResizeAsync(originalMs, 128, 128, PngFormat.Instance);

return new HttpFile(ctx.File)
{
FileName = $"{ctx.FileName.LastLeftPart('.')}_128.{ctx.File.FileName.LastRightPart('.')}",
Expand Down

0 comments on commit d97d26c

Please sign in to comment.