Applications Home|Email


Version 1.0


cAspImage is a vbscript class that lets you read various properties from image files, including width, height and color depth. This cannot be done directly with ASP/vbscript because this type of information has to be parsed out from the image file itself.

Supported file formats are PNG, GIF, BMP and JPG.

How to use this class:

Dim oAspImg
Dim bSuccess

Set oAspImg = New cAspImage

With oAspImg
    bSuccess = .ReadImage(Server.MapPath("some.gif"))
    Response.Write "ImageSize: " & .ImageSize
    Response.Write "Date Created: " & .DateCreated
    Response.Write "Date Last Modified: " & .DateLastModified
    Response.Write "ColorDepth: " & .ColorDepth
    Response.Write "Width: " & .Width
    Response.Write "Height: " & .Height
    Response.Write "ImageType: " & .ImageType
    If Not bSuccess Then Response.Write "Error Message: " & .ErrorMessage
End With

Set oAspImg = Nothing


Method Returns Description
 ReadImage Boolean Returns properties of the image.
b = Object.ReadImage(FilePath)


Property Returns Description
 ImageSize Long Image size in bytes.
lngImageSize = Object.ImageSize
 DateCreated String Date created.
sDateCreated = Object.DateCreated
 DateLastModified String Date last modified.
sDateLastModified = Object.DateLastModified
 ColorDepth Integer Bits per pixel
iColorDepth = Object.ColorDepth
 Width Long Image width in pixels.
lngWidth = Object.Width
 Height Long Image height in pixels.
lngHeight = Object.Height
 ImageType String PNG, GIF87a or GIF89a, BMP or JPG.
sImageType = Object.ImageType
 ErrorMessage String Error message.
sErrMsg = Object.ErrorMessage

You need a web server running ASP (Active Server Pages) with Microsoft Data Access Components installed.


cAspImage.txt ~ 9KB

Therefore: For that or this for it.
© www.u229.no