update image aspect ratio detection

This commit is contained in:
Luke Pulverenti
2017-10-22 02:22:43 -04:00
parent 7e2c52936f
commit 7e5036a587
25 changed files with 155 additions and 75 deletions

View File

@@ -442,19 +442,39 @@ namespace Emby.Drawing
return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower());
}
public ImageSize GetImageSize(ItemImageInfo info, bool allowSlowMethods)
public ImageSize GetImageSize(BaseItem item, ItemImageInfo info)
{
return GetImageSize(info.Path, allowSlowMethods);
return GetImageSize(item, info, false, true);
}
public ImageSize GetImageSize(ItemImageInfo info)
public ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool allowSlowMethods, bool updateItem)
{
return GetImageSize(info.Path, false);
}
var width = info.Width;
var height = info.Height;
public ImageSize GetImageSize(string path)
{
return GetImageSize(path, false);
if (height > 0 && width > 0)
{
return new ImageSize
{
Width = width,
Height = height
};
}
var path = item.Path;
_logger.Info("Getting image size for item {0} {1}", item.GetType().Name, path);
var size = GetImageSize(path, allowSlowMethods);
info.Height = Convert.ToInt32(size.Height);
info.Width = Convert.ToInt32(size.Width);
if (updateItem)
{
_libraryManager().UpdateImages(item);
}
return size;
}
/// <summary>