Update FileController.cs

This commit is contained in:
Leigh Pointer 2021-02-18 08:48:33 +01:00 committed by GitHub
parent 9411f9a62e
commit 45974a9c80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;