diff --git a/Shoko.Server/API/v3/Models/Common/Image.cs b/Shoko.Server/API/v3/Models/Common/Image.cs index 3d98f41a8..0386a91eb 100644 --- a/Shoko.Server/API/v3/Models/Common/Image.cs +++ b/Shoko.Server/API/v3/Models/Common/Image.cs @@ -7,6 +7,7 @@ using Shoko.Models.Enums; using Shoko.Plugin.Abstractions.DataModels; using Shoko.Plugin.Abstractions.Enums; +using Shoko.Server.Models; using Shoko.Server.Models.TMDB; using Shoko.Server.Repositories; using Shoko.Server.Utilities; @@ -97,6 +98,11 @@ public Image(IImageMetadata imageMetadata) Width = tmdbImage.Width; Height = tmdbImage.Height; } + else if (imageMetadata is Image_Base imageBase && imageBase._width.HasValue && imageBase._height.HasValue) + { + Width = imageBase._width.Value; + Height = imageBase._height.Value; + } else if (imageMetadata.IsLocalAvailable && Utils.SettingsProvider.GetSettings().LoadImageMetadata) { Width = imageMetadata.Width; diff --git a/Shoko.Server/Models/Image_Base.cs b/Shoko.Server/Models/Image_Base.cs index 59b309b8d..727599c9b 100644 --- a/Shoko.Server/Models/Image_Base.cs +++ b/Shoko.Server/Models/Image_Base.cs @@ -178,7 +178,7 @@ private async Task CheckIsRemoteAvailableAsync() public double AspectRatio => Width / Height; - private int? _width = null; + internal int? _width = null; /// public virtual int Width @@ -195,7 +195,7 @@ public virtual int Width set { } } - private int? _height = null; + internal int? _height = null; /// public virtual int Height diff --git a/Shoko.Server/Models/TMDB/TMDB_Image.cs b/Shoko.Server/Models/TMDB/TMDB_Image.cs index 76eebede1..61887de23 100644 --- a/Shoko.Server/Models/TMDB/TMDB_Image.cs +++ b/Shoko.Server/Models/TMDB/TMDB_Image.cs @@ -314,6 +314,8 @@ public IImageMetadata GetImageMetadata(bool preferred = false) { IsEnabled = IsEnabled, IsPreferred = preferred, + _width = Width, + _height = Height, }; #endregion