fixed user photo thumbnail generator

This commit is contained in:
Alexey Bannov 2022-02-04 20:59:58 +03:00
parent 8428ef730c
commit eed733b83c
2 changed files with 13 additions and 4 deletions

View File

@ -326,7 +326,12 @@ namespace ASC.Core.Data
private T Deserialize<T>(string data)
{
return JsonSerializer.Deserialize<T>(data);
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
return JsonSerializer.Deserialize<T>(data, options);
}
private string Serialize<T>(T settings)

View File

@ -78,16 +78,20 @@ namespace ASC.Web.Core.Users
var x = thumbnailSettings.Point.X > 0 ? thumbnailSettings.Point.X : 0;
var y = thumbnailSettings.Point.Y > 0 ? thumbnailSettings.Point.Y : 0;
var width = x + thumbnailSettings.Size.Width > mainImg.Width ? mainImg.Width : thumbnailSettings.Size.Width;
var height = y + thumbnailSettings.Size.Height > mainImg.Height ? mainImg.Height : thumbnailSettings.Size.Height;
var rect = new Rectangle(x,
y,
thumbnailSettings.Size.Width,
thumbnailSettings.Size.Height);
width,
height);
Image destRound = mainImg.Clone(x => x.Crop(rect).Resize(new ResizeOptions
{
Size = size,
Mode = ResizeMode.Stretch
}));
}));
return destRound;
}
}