mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Add banner (large) image
This commit is contained in:
parent
7681978435
commit
e144571904
17 changed files with 231 additions and 11 deletions
|
|
@ -10,7 +10,7 @@ using SixLabors.ImageSharp;
|
|||
|
||||
namespace PluralKit.Bot {
|
||||
public static class AvatarUtils {
|
||||
public static async Task VerifyAvatarOrThrow(string url)
|
||||
public static async Task VerifyAvatarOrThrow(string url, bool isFullSizeImage = false)
|
||||
{
|
||||
if (url.Length > Limits.MaxUriLength)
|
||||
throw Errors.UrlTooLong(url);
|
||||
|
|
@ -45,7 +45,7 @@ namespace PluralKit.Bot {
|
|||
var stream = await response.Content.ReadAsStreamAsync();
|
||||
var image = await Task.Run(() => Image.Identify(stream));
|
||||
if (image == null) throw Errors.AvatarInvalid;
|
||||
if (image.Width > Limits.AvatarDimensionLimit || image.Height > Limits.AvatarDimensionLimit) // Check image size
|
||||
if (!isFullSizeImage && (image.Width > Limits.AvatarDimensionLimit || image.Height > Limits.AvatarDimensionLimit)) // Check image size
|
||||
throw Errors.AvatarDimensionsTooLarge(image.Width, image.Height);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue