Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. To get width and height of a image from server

To get width and height of a image from server

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasegraphicssysadmin
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    garga1
    wrote on last edited by
    #1

    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..?

    _ 1 Reply Last reply
    0
    • G garga1

      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..?

      _ Offline
      _ Offline
      _Damian S_
      wrote on last edited by
      #2

      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!!

      G 1 Reply Last reply
      0
      • _ _Damian S_

        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!!

        G Offline
        G Offline
        garga1
        wrote on last edited by
        #3

        Sir, Thank you for reply.. There is permission for folder and path is also exist.

        _ 1 Reply Last reply
        0
        • G garga1

          Sir, Thank you for reply.. There is permission for folder and path is also exist.

          _ Offline
          _ Offline
          _Damian S_
          wrote on last edited by
          #4

          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!!

          G 1 Reply Last reply
          0
          • _ _Damian S_

            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!!

            G Offline
            G Offline
            garga1
            wrote on last edited by
            #5

            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..

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups