reset image dimensions on changes

This commit is contained in:
Luke Pulverenti 2017-10-30 00:52:30 -04:00
parent 8ec8b46394
commit fc9de2589c
2 changed files with 29 additions and 3 deletions

View File

@ -1987,6 +1987,10 @@ namespace MediaBrowser.Controller.Entities
image.Path = file.FullName;
image.DateModified = imageInfo.DateModified;
// reset these values
image.Width = 0;
image.Height = 0;
}
}
@ -2137,6 +2141,7 @@ namespace MediaBrowser.Controller.Entities
var newImageList = new List<FileSystemMetadata>();
var imageAdded = false;
var imageUpdated = false;
foreach (var newImage in images)
{
@ -2157,7 +2162,17 @@ namespace MediaBrowser.Controller.Entities
{
if (existing.IsLocalFile)
{
existing.DateModified = FileSystem.GetLastWriteTimeUtc(newImage);
var newDateModified = FileSystem.GetLastWriteTimeUtc(newImage);
// If date changed then we need to reset saved image dimensions
if (existing.DateModified != newDateModified && (existing.Width > 0 || existing.Height > 0))
{
existing.Width = 0;
existing.Height = 0;
imageUpdated = true;
}
existing.DateModified = newDateModified;
}
}
}
@ -2190,7 +2205,7 @@ namespace MediaBrowser.Controller.Entities
ImageInfos = newList;
}
return newImageList.Count > 0;
return imageUpdated || newImageList.Count > 0;
}
private ItemImageInfo GetImageInfo(FileSystemMetadata file, ImageType type)

View File

@ -412,7 +412,18 @@ namespace MediaBrowser.Providers.Manager
}
else
{
currentImage.DateModified = _fileSystem.GetLastWriteTimeUtc(image.FileInfo);
var newDateModified = _fileSystem.GetLastWriteTimeUtc(image.FileInfo);
// If date changed then we need to reset saved image dimensions
if (currentImage.DateModified != newDateModified && (currentImage.Width > 0 || currentImage.Height > 0))
{
currentImage.Width = 0;
currentImage.Height = 0;
changed = true;
}
currentImage.DateModified = newDateModified;
}
}
else