Accessing Image Properties in ASP

Posted by kheon Wed, 25 May 2005 09:07:00 GMT

I just wrapped up changes to a client application that required me to get image dimensions out of an image dynamically in ASP.

Not wanting to have to use a component (ie: ASPImage) to do this I was able to find some code snippets online that would do what I wanted.

In an effort to save me the time later and hopefully to help someone else, here is the function:

  
  Function GetImageSize ( ByVal psImage )
      Dim asImage(1)
      Dim oFso
      Set oFso = CreateObject("Scripting.FileSystemObject")
      If ( oFso.FileExists(psImage) ) Then
          Set oImage = LoadPicture(psImage)
          asImage(0) = Round(oImage.Width / 26.4883)
          asImage(1) = Round(oImage.Height / 26.4883)
          Set oImage = Nothing
      End If
      Set oFso = Nothing
      GetImageSize = asImage
  End Function
  
  

Posted in  | Tags  | no comments | no trackbacks

Comments

Trackbacks

Use the following link to trackback from your own site:
http://www.kyleheon.com/articles/trackback/34

Comments are disabled