diff --git a/VoidCat/Model/VoidSettings.cs b/VoidCat/Model/VoidSettings.cs
index 3a958c3..7ffb5d0 100644
--- a/VoidCat/Model/VoidSettings.cs
+++ b/VoidCat/Model/VoidSettings.cs
@@ -59,7 +59,7 @@ namespace VoidCat.Model
///
/// CORS origins
///
- public List CorsOrigins { get; init; } = new();
+ public List CorsOrigins { get; init; } = new();
///
/// Cloud file storage settings
diff --git a/VoidCat/Services/Files/CompressContent.cs b/VoidCat/Services/Files/CompressContent.cs
index e6e64bd..ca38993 100644
--- a/VoidCat/Services/Files/CompressContent.cs
+++ b/VoidCat/Services/Files/CompressContent.cs
@@ -1,3 +1,4 @@
+using ExifLibrary;
using FFMpegCore;
namespace VoidCat.Services.Files;
@@ -21,6 +22,7 @@ public class CompressContent
{
string? outMime = null;
var inExt = Path.GetExtension(input).ToLower();
+ var isImage = false;
switch (inExt)
{
case ".jpg":
@@ -32,10 +34,12 @@ public class CompressContent
{
output = Path.ChangeExtension(output, ".webp");
outMime = "image/webp";
+ isImage = true;
break;
}
}
-
+
+ var probe = isImage ? await ImageFile.FromFileAsync(input) : default;
var ffmpeg = FFMpegArguments
.FromFileInput(input)
.OutputToFile(output, true, o =>
@@ -45,6 +49,22 @@ public class CompressContent
{
o.Loop(0);
}
+
+ if (probe != default)
+ {
+ var orientation = probe.Properties.Get>(ExifTag.Orientation);
+ if (orientation != default && orientation.Value != Orientation.Normal)
+ {
+ if (orientation.Value == Orientation.RotatedRight)
+ {
+ o.WithCustomArgument("-metadata:s:v rotate=\"90\"");
+ }
+ else if (orientation.Value == Orientation.RotatedLeft)
+ {
+ o.WithCustomArgument("-metadata:s:v rotate=\"-90\"");
+ }
+ }
+ }
})
.CancellableThrough(cts);
diff --git a/VoidCat/VoidCat.csproj b/VoidCat/VoidCat.csproj
index 8cb90bd..d8784ab 100644
--- a/VoidCat/VoidCat.csproj
+++ b/VoidCat/VoidCat.csproj
@@ -16,6 +16,7 @@
+
diff --git a/VoidCat/VoidStartup.cs b/VoidCat/VoidStartup.cs
index e853123..3395cd1 100644
--- a/VoidCat/VoidStartup.cs
+++ b/VoidCat/VoidStartup.cs
@@ -112,7 +112,7 @@ public static class VoidStartup
if (voidSettings.CorsOrigins.Count > 0)
{
- p.WithOrigins(voidSettings.CorsOrigins.Select(a => a.ToString()).ToArray())
+ p.WithOrigins(voidSettings.CorsOrigins.ToArray())
.AllowCredentials();
}
else