Contact Us

Scripts: asp :: ASP File System :: Library Article #2

Developer's Section

Get Image Dimensions in ASP
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating:  | Rate It:   
Average Votes: (3096)

Get dimensions of an image using ASP

This article shows how to get the dimensions of any .gif or .jpeg image file.
You will need the file: imageSpecifications.asp to use this script (the file is provided in the downloads box of this article).

 Code Snippet 1

<!--#include file='imageSpecifications.asp'-->


Dim fileObject
Dim imageFile
Dim imagePath
Dim width     'image width
Dim height    'image height
Dim strType   'image type
Dim c         'additional information

Set fileObject =Server.CreateObject("Scripting.FileSystemObject")
'make sure you get the full path of the image
imagePath = Server.Mappath("files/myImage.jpg")
Set imageFile = fileObject.GetFile(imagePath)

dimensions = findDimensions(imageFile.Path, Width, Height, c, strType)

Response.Write("your Image width is: " & width & "<br>")
Response.Write("your image height is: " & height & "<br>" )

set fileObject=nothing
set imageFile=nothing


imageSpecifications.asp7.8 KB

See other Scripts in ASP File System

Submit Your Scripts:

If you would like to have your ASP & ASP.NET scripts published in this section please fill out
the form below:
*Your Name or Username:
Home Town:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]