[backend/drive] Fix missing image processing resolution check
This commit is contained in:
parent
7b3e9bbbca
commit
f903a1d8a4
3 changed files with 11 additions and 2 deletions
|
@ -209,6 +209,8 @@ public sealed class Config
|
||||||
|
|
||||||
[Range(0, 128)] public int ImageProcessorConcurrency { get; init; } = 8;
|
[Range(0, 128)] public int ImageProcessorConcurrency { get; init; } = 8;
|
||||||
|
|
||||||
|
public int MaxResolutionPx => MaxResolutionMpx * 1000 * 1000;
|
||||||
|
|
||||||
public string MaxFileSize
|
public string MaxFileSize
|
||||||
{
|
{
|
||||||
get => MaxFileSizeBytes.ToString();
|
get => MaxFileSizeBytes.ToString();
|
||||||
|
|
|
@ -261,8 +261,16 @@ public class DriveService(
|
||||||
logger.LogDebug("Image is animated, bypassing image processing...");
|
logger.LogDebug("Image is animated, bypassing image processing...");
|
||||||
skipImageProcessing = true;
|
skipImageProcessing = true;
|
||||||
}
|
}
|
||||||
|
else if (ident.Width * ident.Height > storageConfig.Value.MediaProcessing.MaxResolutionPx)
|
||||||
|
{
|
||||||
|
logger.LogDebug("Image is larger than {mpx}mpx ({width}x{height}), bypassing image processing...",
|
||||||
|
storageConfig.Value.MediaProcessing.MaxResolutionMpx, ident.Width,
|
||||||
|
ident.Height);
|
||||||
|
skipImageProcessing = true;
|
||||||
|
}
|
||||||
|
|
||||||
var formats = GetFormats(user, request, skipImageProcessing);
|
var formats = GetFormats(user, request, skipImageProcessing);
|
||||||
|
|
||||||
var res = imageProcessor.ProcessImage(buf, ident, request, formats);
|
var res = imageProcessor.ProcessImage(buf, ident, request, formats);
|
||||||
properties = res;
|
properties = res;
|
||||||
blurhash = res.Blurhash;
|
blurhash = res.Blurhash;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security;
|
|
||||||
using CommunityToolkit.HighPerformance;
|
using CommunityToolkit.HighPerformance;
|
||||||
using Iceshrimp.Backend.Core.Helpers;
|
using Iceshrimp.Backend.Core.Helpers;
|
||||||
using NetVips;
|
using NetVips;
|
||||||
|
|
Loading…
Add table
Reference in a new issue