#1120 Fix forUpload SVG throw error

This commit is contained in:
Leigh Pointer
2021-02-18 08:38:53 +01:00
parent a60859ba19
commit e3fc7c0ad1

View File

@ -538,10 +538,15 @@ namespace Oqtane.Controllers
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;
file.ImageWidth = image.Width;
//svg has no image and height, the attributes for svg are held in the XML viewport
if(file.Extension != "svg")
{
using (var image = Image.FromStream(stream))
{
file.ImageHeight = image.Height;
file.ImageWidth = image.Width;
}
}
stream.Close();