diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-01-21 03:23:02 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-01-21 11:58:07 -0500 |
| commit | aaf316884d4e705a9dc47002f492f28649e4821b (patch) | |
| tree | 424c08cb5a8e804041eda67dabdbd55a05ae69ea /MediaBrowser.Server.Implementations | |
| parent | 086713064ca884655b41f15f6cb61766c5bf2ea0 (diff) | |
support photo orientation
Diffstat (limited to 'MediaBrowser.Server.Implementations')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Dto/DtoService.cs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index b0071828e..0cd551f6a 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1783,11 +1783,31 @@ namespace MediaBrowser.Server.Implementations.Dto } } - if (size.Width > 0 && size.Height > 0) + var width = size.Width; + var height = size.Height; + + if (width == 0 || height == 0) { - return size.Width / size.Height; + return null; } - return null; + + var photo = item as Photo; + if (photo != null && photo.Orientation.HasValue) + { + switch (photo.Orientation.Value) + { + case ImageOrientation.LeftBottom: + case ImageOrientation.LeftTop: + case ImageOrientation.RightBottom: + case ImageOrientation.RightTop: + var temp = height; + height = width; + width = temp; + break; + } + } + + return width / height; } } } |
