I'm trying to access EXIF metadata for images in my Umbraco Media Library using System.Drawing.Image.FromFile
and whilst I can get my code to work passing a path for a local file on my HDD (e.g. c:\example.jpg) I get a file not found exception if I pass the URL for an item in my media library.
I have tried concatenating the URL with http://localhost:xxxx, and I get an error that the format is incorrect. I've tried this with a full Url of an image hosted online and get same, which leads me to suspect that FromFile doesn't accept an Url.
I can't find any documentation to support this theory though, and it seems, dumb?
TL;DR why does a path work for System.Drawing.Image.FromFile
but not a Url?
Here's my code:
var testImage = Model.Value<IPublishedContent>("testImage");
System.Drawing.Image image = System.Drawing.Image.FromFile(testImage.Url);