To get width and height of a image from server
-
Hi frnds, I hv a code to get width and height of image in a file. Image is stored in folder and imagename in database.. I'm using asp.net 2.0 and sqlserver 2005. Dim width,Height as integer ImgPath = "~/Photos/" & ImgName Dim fullSizeImg As System.Drawing.Image = System.Drawing.Image.FromFile(ImgPath) width = fullSizeImg.Width Height = fullSizeImg.Height This works only in localhost. But after uploading to server it is not working. Is ther any other method to get the width and height of the image from server..?
-
Hi frnds, I hv a code to get width and height of image in a file. Image is stored in folder and imagename in database.. I'm using asp.net 2.0 and sqlserver 2005. Dim width,Height as integer ImgPath = "~/Photos/" & ImgName Dim fullSizeImg As System.Drawing.Image = System.Drawing.Image.FromFile(ImgPath) width = fullSizeImg.Width Height = fullSizeImg.Height This works only in localhost. But after uploading to server it is not working. Is ther any other method to get the width and height of the image from server..?
The most common problem when something "works locally, but not on the server", is because the path that you are expecting your images to be in either doesn't exist on the server, or you don't have permissions to access it. Check those first, then get back to us with more details about the error that you are getting.
I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!
-
The most common problem when something "works locally, but not on the server", is because the path that you are expecting your images to be in either doesn't exist on the server, or you don't have permissions to access it. Check those first, then get back to us with more details about the error that you are getting.
I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!
-
Okay, so assuming they exist (and the file also exists), what is the actual error you are receiving?
I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!
-
Okay, so assuming they exist (and the file also exists), what is the actual error you are receiving?
I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!
Sir, This is the error i'm getting.. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Source Error: Line 42: Line 43: Public Sub CheckWH() Line 44: Dim fullSizeImg As System.Drawing.Image = System.Drawing.Image.FromFile(str) Line 45: Line 46: Source File: D:\Hosting\5201676\html\Gallery.aspx.vb Line: 44 i think it is giving error for FromFile(str). Whether FromFile() is used only to get path from localhost ? Plse reply..