From 45974a9c8038d4ebc96536548db2e6e28b225829 Mon Sep 17 00:00:00 2001 From: Leigh Pointer Date: Thu, 18 Feb 2021 08:48:33 +0100 Subject: [PATCH] Update FileController.cs --- Oqtane.Server/Controllers/FileController.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Oqtane.Server/Controllers/FileController.cs b/Oqtane.Server/Controllers/FileController.cs index 9e8b3d35..07a85f20 100644 --- a/Oqtane.Server/Controllers/FileController.cs +++ b/Oqtane.Server/Controllers/FileController.cs @@ -535,13 +535,12 @@ namespace Oqtane.Controllers file.ImageHeight = 0; file.ImageWidth = 0; - if (Constants.ImageFiles.Split(',').Contains(file.Extension.ToLower())) - { - FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read); - - //svg has no image and height, the attributes for svg are held in the XML viewport - if(file.Extension != "svg") - { + //svg has no image and height, the attributes for svg are held in the XML viewport + if(file.Extension != "svg") + { + if (Constants.ImageFiles.Split(',').Contains(file.Extension.ToLower())) + { + FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read); using (var image = Image.FromStream(stream)) { file.ImageHeight = image.Height;