I am trying to access height and width of an System.Drawing.Image
.
Image image = Image.FromFile(PostedImage.ImageUrl.ToString());
int ActualWidth = image.Width;
int ActualHeight = image.Height;
I am getting error
URI formats are not supported.
How can this be done?
This means that you cannot sent a URL to Image.FromFile()
You must pass a local path on disk.
To remedy this:
Image.FromStream()
my guess is that FromFile works on local files only. i would fetch the file using WebRequest and then create Image from stream.
You have to pass a path to a local file or one on a network drive.
If the string you give it is to a web resources, you have to first download it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.